mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
pvfs_open: call pvfs_setup_oplock() if an oplock was granted
This is needed to receive oplock breaks from other "processes" metze
This commit is contained in:
parent
b09a2b1267
commit
dd56f55afd
@ -268,6 +268,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
|
||||
f->handle->seek_offset = 0;
|
||||
f->handle->position = 0;
|
||||
f->handle->mode = 0;
|
||||
f->handle->oplock = NULL;
|
||||
f->handle->sticky_write_time = false;
|
||||
f->handle->open_completed = false;
|
||||
|
||||
@ -684,9 +685,6 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
|
||||
return status;
|
||||
}
|
||||
|
||||
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
|
||||
oplock_granted = OPLOCK_BATCH;
|
||||
}
|
||||
|
||||
f->ntvfs = h;
|
||||
f->pvfs = pvfs;
|
||||
@ -705,12 +703,23 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
|
||||
f->handle->seek_offset = 0;
|
||||
f->handle->position = 0;
|
||||
f->handle->mode = 0;
|
||||
f->handle->oplock = NULL;
|
||||
f->handle->have_opendb_entry = true;
|
||||
f->handle->sticky_write_time = false;
|
||||
f->handle->open_completed = false;
|
||||
|
||||
DLIST_ADD(pvfs->files.list, f);
|
||||
|
||||
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
|
||||
oplock_granted = OPLOCK_BATCH;
|
||||
} else if (oplock_granted != OPLOCK_NONE) {
|
||||
status = pvfs_setup_oplock(f, oplock_granted);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_free(lck);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
/* setup a destructor to avoid file descriptor leaks on
|
||||
abnormal termination */
|
||||
talloc_set_destructor(f, pvfs_fnum_destructor);
|
||||
@ -1185,6 +1194,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
|
||||
f->handle->seek_offset = 0;
|
||||
f->handle->position = 0;
|
||||
f->handle->mode = 0;
|
||||
f->handle->oplock = NULL;
|
||||
f->handle->have_opendb_entry = false;
|
||||
f->handle->sticky_write_time = false;
|
||||
f->handle->open_completed = false;
|
||||
@ -1257,6 +1267,12 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
|
||||
|
||||
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
|
||||
oplock_granted = OPLOCK_BATCH;
|
||||
} else if (oplock_granted != OPLOCK_NONE) {
|
||||
status = pvfs_setup_oplock(f, oplock_granted);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_free(lck);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
f->handle->have_opendb_entry = true;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "dsdb/samdb/samdb.h"
|
||||
|
||||
struct pvfs_wait;
|
||||
struct pvfs_oplock;
|
||||
|
||||
/* this is the private structure for the posix vfs backend. It is used
|
||||
to hold per-connection (per tree connect) state information */
|
||||
@ -154,6 +155,13 @@ struct pvfs_file_handle {
|
||||
|
||||
bool have_opendb_entry;
|
||||
|
||||
/*
|
||||
* we need to wait for oplock break requests from other processes,
|
||||
* and we need to remember the pvfs_file so we can correctly
|
||||
* forward the oplock break to the client
|
||||
*/
|
||||
struct pvfs_oplock *oplock;
|
||||
|
||||
/* we need this hook back to our parent for lock destruction */
|
||||
struct pvfs_state *pvfs;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user