Author: jra
Date: 2007-05-26 01:26:09 +0000 (Sat, 26 May 2007)
New Revision: 23151

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23151

Log:
Re-arrange the logic so it looks identical to the
"file existed" case above. This has no functional
change but is easier to see that it's doing the
same thing.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/open.c
   branches/SAMBA_3_0_25/source/smbd/open.c
   branches/SAMBA_3_0_26/source/smbd/open.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/open.c       2007-05-26 01:19:51 UTC (rev 
23150)
+++ branches/SAMBA_3_0/source/smbd/open.c       2007-05-26 01:26:09 UTC (rev 
23151)
@@ -1663,6 +1663,20 @@
                                         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 @@
                        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*.....
                 */

Modified: branches/SAMBA_3_0_25/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/open.c    2007-05-26 01:19:51 UTC (rev 
23150)
+++ branches/SAMBA_3_0_25/source/smbd/open.c    2007-05-26 01:26:09 UTC (rev 
23151)
@@ -1665,6 +1665,20 @@
                                         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;
 
@@ -1688,14 +1702,6 @@
                        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*.....
                 */

Modified: branches/SAMBA_3_0_26/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/open.c    2007-05-26 01:19:51 UTC (rev 
23150)
+++ branches/SAMBA_3_0_26/source/smbd/open.c    2007-05-26 01:26:09 UTC (rev 
23151)
@@ -1667,6 +1667,20 @@
                                         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;
 
@@ -1690,14 +1704,6 @@
                        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*.....
                 */

Reply via email to