r23151: Re-arrange the logic so it looks identical to the
authorJeremy Allison <jra@samba.org>
Sat, 26 May 2007 01:26:09 +0000 (01:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:22:49 +0000 (12:22 -0500)
"file existed" case above. This has no functional
change but is easier to see that it's doing the
same thing.
Jeremy.

source/smbd/open.c

index ccd12c6946d40a9755de164821cca04a0e79d8cb..987da7a94daa0bd79df39bafff3272f8587250f1 100644 (file)
@@ -1663,6 +1663,20 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                                         access_mask, share_access,
                                         create_options, &file_existed);
 
+               if (NT_STATUS_IS_OK(status)) {
+                       /* We might be going to allow this open. Check oplock
+                        * status again. */
+                       /* Second pass - send break for both batch or
+                        * exclusive oplocks. */
+                       if (delay_for_oplocks(lck, fsp, 2, oplock_request)) {
+                               schedule_defer_open(lck, request_time);
+                               TALLOC_FREE(lck);
+                               fd_close(conn, fsp);
+                               file_free(fsp);
+                               return NT_STATUS_SHARING_VIOLATION;
+                       }
+               }
+
                if (!NT_STATUS_IS_OK(status)) {
                        struct deferred_open_record state;
 
@@ -1686,14 +1700,6 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        return status;
                }
 
-               if (delay_for_oplocks(lck, fsp, 2, oplock_request)) {
-                       schedule_defer_open(lck, request_time);
-                       TALLOC_FREE(lck);
-                       fd_close(conn, fsp);
-                       file_free(fsp);
-                       return NT_STATUS_SHARING_VIOLATION;
-               }
-
                /*
                 * We exit this block with the share entry *locked*.....
                 */