]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: rename is_stat_open() to is_oplock_stat_open()
authorRalph Boehme <slow@samba.org>
Thu, 5 Mar 2020 14:12:20 +0000 (15:12 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 30 Apr 2020 19:32:45 +0000 (19:32 +0000)
Testing stat opens with with leases reveals that that the access mask

  SYNCHRONIZE_ACCESS | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES

is specific to oplocks.

See also:

https://lists.samba.org/archive/cifs-protocol/2020-March/003409.html

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14357

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c
source3/smbd/proto.h

index aa86cef944a2056a8fa20cc48729944bc0986a29..b5160300e48f5d19e59e5686eac92a2a23f56062 100644 (file)
@@ -1563,7 +1563,10 @@ static bool validate_my_share_entries_fn(
 }
 #endif
 
-bool is_stat_open(uint32_t access_mask)
+/**
+ * Allowed access mask for stat opens relevant to oplocks
+ **/
+bool is_oplock_stat_open(uint32_t access_mask)
 {
        const uint32_t stat_open_bits =
                (SYNCHRONIZE_ACCESS|
@@ -1771,7 +1774,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
        uint16_t new_flags;
        bool ok, conflict, have_share_entries;
 
-       if (is_stat_open(access_mask)) {
+       if (is_oplock_stat_open(access_mask)) {
                /* Stat open that doesn't trigger oplock breaks or share mode
                 * checks... ! JRA. */
                return NT_STATUS_OK;
@@ -1928,7 +1931,7 @@ static bool validate_oplock_types_fn(
                return false;
        }
 
-       if (e->op_type == NO_OPLOCK && is_stat_open(e->access_mask)) {
+       if (e->op_type == NO_OPLOCK && is_oplock_stat_open(e->access_mask)) {
                /*
                 * We ignore stat opens in the table - they always
                 * have NO_OPLOCK and never get or cause breaks. JRA.
@@ -2422,7 +2425,7 @@ static NTSTATUS delay_for_oplock(files_struct *fsp,
        NTSTATUS status;
        bool ok;
 
-       if (is_stat_open(fsp->access_mask)) {
+       if (is_oplock_stat_open(fsp->access_mask)) {
                goto grant;
        }
 
@@ -3491,7 +3494,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                 * FILE_OVERWRITE and FILE_OVERWRITE_IF add in O_TRUNC,
                 * which adds FILE_WRITE_DATA to open_access_mask.
                 */
-               if (is_stat_open(open_access_mask) && lease == NULL) {
+               if (is_oplock_stat_open(open_access_mask) && lease == NULL) {
                        oplock_request = NO_OPLOCK;
                }
        }
index 3d9ffaa6898e7dae2b4c48f6ff9f66c2a565e017..5713620ab6ef3478fc6ad7978a3679550492b02f 100644 (file)
@@ -713,7 +713,7 @@ NTSTATUS fd_close(files_struct *fsp);
 void change_file_owner_to_parent(connection_struct *conn,
                                 struct smb_filename *inherit_from_dir,
                                 files_struct *fsp);
-bool is_stat_open(uint32_t access_mask);
+bool is_oplock_stat_open(uint32_t access_mask);
 NTSTATUS send_break_message(struct messaging_context *msg_ctx,
                            const struct file_id *id,
                            const struct share_mode_entry *exclusive,