summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_open.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-15 12:22:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:07:00 -0500
commit5e6d1ea2618851ef99522a806f36916127e5294a (patch)
tree4671b44c2bca74104a132ff432a4e355cb3a2d1a /source4/ntvfs/posix/pvfs_open.c
parentbe0bd9fa336464e7c1fa2ab7cc5cd34075d595ce (diff)
downloadsamba-5e6d1ea2618851ef99522a806f36916127e5294a.tar.gz
samba-5e6d1ea2618851ef99522a806f36916127e5294a.tar.bz2
samba-5e6d1ea2618851ef99522a806f36916127e5294a.zip
r15614: the byte range locking error handling caches the last failed lock
per file handle and not per tree connect metze (This used to be commit 5d825261c0b8341f0a7f0f6d96d83807352566f4)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_open.c')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 9570fa08d9..3bbf840154 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -277,13 +277,13 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
f->share_access = io->generic.in.share_access;
f->impersonation = io->generic.in.impersonation;
f->access_mask = access_mask;
+ f->brl_handle = NULL;
f->notify_buffer = NULL;
f->handle->pvfs = pvfs;
f->handle->name = talloc_steal(f->handle, name);
f->handle->fd = -1;
f->handle->odb_locking_key = data_blob(NULL, 0);
- f->handle->brl_locking_key = data_blob(NULL, 0);
f->handle->create_options = io->generic.in.create_options;
f->handle->seek_offset = 0;
f->handle->position = 0;
@@ -526,32 +526,37 @@ static int pvfs_fnum_destructor(void *p)
account of file streams (each stream is a separate byte range
locking space)
*/
-static NTSTATUS pvfs_brl_locking_key(struct pvfs_filename *name,
- TALLOC_CTX *mem_ctx, DATA_BLOB *key)
+static NTSTATUS pvfs_brl_locking_handle(TALLOC_CTX *mem_ctx,
+ struct pvfs_filename *name,
+ uint16_t fnum,
+ struct brl_handle **_h)
{
- DATA_BLOB odb_key;
+ DATA_BLOB odb_key, key;
NTSTATUS status;
+ struct brl_handle *h;
+
status = pvfs_locking_key(name, mem_ctx, &odb_key);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
+ NT_STATUS_NOT_OK_RETURN(status);
+
if (name->stream_name == NULL) {
- *key = odb_key;
- return NT_STATUS_OK;
- }
- *key = data_blob_talloc(mem_ctx, NULL,
- odb_key.length + strlen(name->stream_name) + 1);
- if (key->data == NULL) {
- return NT_STATUS_NO_MEMORY;
+ key = odb_key;
+ } else {
+ key = data_blob_talloc(mem_ctx, NULL,
+ odb_key.length + strlen(name->stream_name) + 1);
+ NT_STATUS_HAVE_NO_MEMORY(key.data);
+ memcpy(key.data, odb_key.data, odb_key.length);
+ memcpy(key.data + odb_key.length,
+ name->stream_name, strlen(name->stream_name) + 1);
+ data_blob_free(&odb_key);
}
- memcpy(key->data, odb_key.data, odb_key.length);
- memcpy(key->data + odb_key.length,
- name->stream_name, strlen(name->stream_name)+1);
- data_blob_free(&odb_key);
+
+ h = brl_create_handle(mem_ctx, &key, fnum);
+ NT_STATUS_HAVE_NO_MEMORY(h);
+
+ *_h = h;
return NT_STATUS_OK;
}
-
/*
create a new file
*/
@@ -665,7 +670,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
goto cleanup_delete;
}
- status = pvfs_brl_locking_key(name, f->handle, &f->handle->brl_locking_key);
+ status = pvfs_brl_locking_handle(f, name, fnum, &f->brl_handle);
if (!NT_STATUS_IS_OK(status)) {
goto cleanup_delete;
}
@@ -1168,7 +1173,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return status;
}
- status = pvfs_brl_locking_key(name, f->handle, &f->handle->brl_locking_key);
+ status = pvfs_brl_locking_handle(f, name, f->fnum, &f->brl_handle);
if (!NT_STATUS_IS_OK(status)) {
idr_remove(pvfs->files.idtree, f->fnum);
return status;