smbd: Move oplock/sharemode ops into one place
authorVolker Lendecke <vl@samba.org>
Tue, 3 Sep 2013 14:02:09 +0000 (14:02 +0000)
committerDavid Disseldorp <ddiss@samba.org>
Thu, 24 Oct 2013 12:22:05 +0000 (14:22 +0200)
This makes the is_stat_open special case in grant_fsp_oplock_type
redundant because in open_file_ntcreate further up we have already set
oplock_request to NO_OPLOCK for stat opens.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
source3/smbd/open.c

index 4db673a..28c2c1c 100644 (file)
@@ -1435,13 +1435,6 @@ static void grant_fsp_oplock_type(files_struct *fsp,
                fsp->oplock_type = NO_OPLOCK;
        }
 
-       if (is_stat_open(fsp->access_mask)) {
-               /* Leave the value already set. */
-               DEBUG(10,("grant_fsp_oplock_type: oplock type 0x%x on file %s\n",
-                       fsp->oplock_type, fsp_str_dbg(fsp)));
-               return;
-       }
-
        got_level2_oplock = false;
        got_a_none_oplock = false;
 
@@ -2617,8 +2610,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                return status;
        }
 
-       grant_fsp_oplock_type(fsp, lck, oplock_request);
-
        /*
         * We have the share entry *locked*.....
         */
@@ -2680,7 +2671,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
        if (file_existed) {
                /* stat opens on existing files don't get oplocks. */
                if (is_stat_open(open_access_mask)) {
-                       fsp->oplock_type = NO_OPLOCK;
+                       oplock_request = NO_OPLOCK;
                }
        }
 
@@ -2703,6 +2694,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
         * file structs.
         */
 
+       grant_fsp_oplock_type(fsp, lck, oplock_request);
+
        status = set_file_oplock(fsp);
        if (!NT_STATUS_IS_OK(status)) {
                /*