/* see if we are allowed to open at the same time as existing opens */
status = odb_open_file(lck, f->handle, f->handle->name->stream_id,
- share_access, access_mask, del_on_close, name->full_name);
+ share_access, access_mask, del_on_close,
+ name->full_name, OPLOCK_NONE, NULL);
if (!NT_STATUS_IS_OK(status)) {
idr_remove(pvfs->files.idtree, f->fnum);
}
status = odb_open_file(lck, f->handle, f->handle->name->stream_id,
- share_access, access_mask, del_on_close, name->full_name);
+ share_access, access_mask, del_on_close,
+ name->full_name, OPLOCK_NONE, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto cleanup_delete;
uint32_t attrib;
BOOL del_on_close;
struct pvfs_filename *parent;
+ uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
if ((io->ntcreatex.in.file_attr & FILE_ATTRIBUTE_READONLY) &&
(create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE)) {
del_on_close = False;
}
+ if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
+ oplock_level = OPLOCK_NONE;
+ } else if (io->ntcreatex.in.flags & NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK) {
+ oplock_level = OPLOCK_BATCH;
+ } else if (io->ntcreatex.in.flags & NTCREATEX_FLAGS_REQUEST_OPLOCK) {
+ oplock_level = OPLOCK_EXCLUSIVE;
+ }
+
status = odb_open_file(lck, f->handle, name->stream_id,
- share_access, access_mask, del_on_close, name->full_name);
+ share_access, access_mask, del_on_close,
+ name->full_name, oplock_level, &oplock_granted);
talloc_free(lck);
if (!NT_STATUS_IS_OK(status)) {
/* bad news, we must have hit a race - we don't delete the file
return status;
}
+ if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
+ oplock_granted = OPLOCK_BATCH;
+ }
+
f->fnum = fnum;
f->session_info = req->session_info;
f->smbpid = req->smbpid;
talloc_set_destructor(f, pvfs_fnum_destructor);
talloc_set_destructor(f->handle, pvfs_handle_destructor);
-
- if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
- io->generic.out.oplock_level = OPLOCK_BATCH;
- } else {
- io->generic.out.oplock_level = OPLOCK_NONE;
- }
+ io->generic.out.oplock_level = oplock_granted;
io->generic.out.file.fnum = f->fnum;
io->generic.out.create_action = NTCREATEX_ACTION_CREATED;
io->generic.out.create_time = name->dos.create_time;
uint32_t share_access;
uint32_t access_mask;
BOOL stream_existed, stream_truncate=False;
+ uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
/* use the generic mapping code to avoid implementing all the
different open calls. */
talloc_set_destructor(f, pvfs_fnum_destructor);
talloc_set_destructor(f->handle, pvfs_handle_destructor);
+ if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
+ oplock_level = OPLOCK_NONE;
+ } else if (io->ntcreatex.in.flags & NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK) {
+ oplock_level = OPLOCK_BATCH;
+ } else if (io->ntcreatex.in.flags & NTCREATEX_FLAGS_REQUEST_OPLOCK) {
+ oplock_level = OPLOCK_EXCLUSIVE;
+ }
+
/* see if we are allowed to open at the same time as existing opens */
status = odb_open_file(lck, f->handle, f->handle->name->stream_id,
- share_access, access_mask, False, name->full_name);
+ share_access, access_mask, False, name->full_name,
+ oplock_level, &oplock_granted);
/* on a sharing violation we need to retry when the file is closed by
the other user, or after 1 second */
return status;
}
+ if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
+ oplock_granted = OPLOCK_BATCH;
+ }
+
f->handle->have_opendb_entry = True;
if (access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)) {
talloc_free(lck);
- if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
- io->generic.out.oplock_level = OPLOCK_BATCH;
- } else {
- io->generic.out.oplock_level = OPLOCK_NONE;
- }
+ io->generic.out.oplock_level = oplock_granted;
io->generic.out.file.fnum = f->fnum;
io->generic.out.create_action = stream_existed?
NTCREATEX_ACTION_EXISTED:NTCREATEX_ACTION_CREATED;