From ae7caf08c1f47f3ad08856cfea2a3e6e956b48ab Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Nov 2004 05:58:04 +0000 Subject: r3798: added support for alternate data streams in xattrs into pvfs. The trickiest part about this was getting the sharing and locking rules right, as alternate streams are separate locking spaces from the main file for the purposes of byte range locking, and separate for most share violation rules. I suspect there are still problems with delete on close with alternate data streams. I'll look at that next. (This used to be commit b6452c4a2068cf7e837778559da002ae191b508a) --- source4/ntvfs/common/opendb.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs/common/opendb.c') diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index a07b657c33..64bed53c8b 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -54,6 +54,7 @@ struct odb_context { struct odb_entry { servid_t server; void *file_handle; + uint32_t stream_id; uint32_t share_access; uint32_t create_options; uint32_t access_mask; @@ -167,14 +168,20 @@ static BOOL share_conflict(struct odb_entry *e1, struct odb_entry *e2) return False; } - /* check the basic share access */ + /* data IO access masks. This is skipped if the two open handles + are on different streams (as in that case the masks don't + interact) */ + if (e1->stream_id != e2->stream_id) { + return False; + } + CHECK_MASK(e1->access_mask, e2->share_access, SA_RIGHT_FILE_WRITE_APPEND, NTCREATEX_SHARE_ACCESS_WRITE); CHECK_MASK(e2->access_mask, e1->share_access, SA_RIGHT_FILE_WRITE_APPEND, NTCREATEX_SHARE_ACCESS_WRITE); - + CHECK_MASK(e1->access_mask, e2->share_access, SA_RIGHT_FILE_READ_EXEC, NTCREATEX_SHARE_ACCESS_READ); @@ -203,6 +210,7 @@ static BOOL share_conflict(struct odb_entry *e1, struct odb_entry *e2) rules */ NTSTATUS odb_open_file(struct odb_lock *lck, void *file_handle, + uint32_t stream_id, uint32_t share_access, uint32_t create_options, uint32_t access_mask) { @@ -217,6 +225,7 @@ NTSTATUS odb_open_file(struct odb_lock *lck, void *file_handle, e.server = odb->server; e.file_handle = file_handle; + e.stream_id = stream_id; e.share_access = share_access; e.create_options = create_options; e.access_mask = access_mask; @@ -273,6 +282,7 @@ NTSTATUS odb_open_file_pending(struct odb_lock *lck, void *private) e.server = odb->server; e.file_handle = NULL; + e.stream_id = 0; e.share_access = 0; e.create_options = 0; e.access_mask = 0; @@ -496,6 +506,7 @@ NTSTATUS odb_can_open(struct odb_context *odb, DATA_BLOB *key, e.server = odb->server; e.file_handle = NULL; + e.stream_id = 0; e.share_access = share_access; e.create_options = create_options; e.access_mask = access_mask; -- cgit