Author: jra
Date: 2007-05-26 01:19:51 +0000 (Sat, 26 May 2007)
New Revision: 23150

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

Log:
Fix Samba3 in the build farm again. In the case where the
file was being created and we go into the race condition check,
we were testing for compatible open modes, but were not breaking
oplocks in the same way as if the file existed. This meant that
we weren't going into the code path that sets fsp->oplock = FAKE_LEVEL_II_OPLOCK
if the client didn't ask for an oplock on file create. We need
to do this as internally it's what Windows does.
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 00:25:22 UTC (rev 
23149)
+++ branches/SAMBA_3_0/source/smbd/open.c       2007-05-26 01:19:51 UTC (rev 
23150)
@@ -1650,6 +1650,15 @@
                        return NT_STATUS_SHARING_VIOLATION;
                }
 
+               /* First pass - send break only on batch oplocks. */
+               if (delay_for_oplocks(lck, fsp, 1, oplock_request)) {
+                       schedule_defer_open(lck, request_time);
+                       TALLOC_FREE(lck);
+                       fd_close(conn, fsp);
+                       file_free(fsp);
+                       return NT_STATUS_SHARING_VIOLATION;
+               }
+
                status = open_mode_check(conn, fname, lck,
                                         access_mask, share_access,
                                         create_options, &file_existed);
@@ -1677,6 +1686,14 @@
                        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 00:25:22 UTC (rev 
23149)
+++ branches/SAMBA_3_0_25/source/smbd/open.c    2007-05-26 01:19:51 UTC (rev 
23150)
@@ -1652,6 +1652,15 @@
                        return NT_STATUS_SHARING_VIOLATION;
                }
 
+               /* First pass - send break only on batch oplocks. */
+               if (delay_for_oplocks(lck, fsp, 1, oplock_request)) {
+                       schedule_defer_open(lck, request_time);
+                       TALLOC_FREE(lck);
+                       fd_close(conn, fsp);
+                       file_free(fsp);
+                       return NT_STATUS_SHARING_VIOLATION;
+               }
+
                status = open_mode_check(conn, fname, lck,
                                         access_mask, share_access,
                                         create_options, &file_existed);
@@ -1679,6 +1688,14 @@
                        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 00:25:22 UTC (rev 
23149)
+++ branches/SAMBA_3_0_26/source/smbd/open.c    2007-05-26 01:19:51 UTC (rev 
23150)
@@ -1654,6 +1654,15 @@
                        return NT_STATUS_SHARING_VIOLATION;
                }
 
+               /* First pass - send break only on batch oplocks. */
+               if (delay_for_oplocks(lck, fsp, 1, oplock_request)) {
+                       schedule_defer_open(lck, request_time);
+                       TALLOC_FREE(lck);
+                       fd_close(conn, fsp);
+                       file_free(fsp);
+                       return NT_STATUS_SHARING_VIOLATION;
+               }
+
                status = open_mode_check(conn, fname, lck,
                                         access_mask, share_access,
                                         create_options, &file_existed);
@@ -1681,6 +1690,14 @@
                        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