r23150: Fix Samba3 in the build farm again. In the case where the
[sfrench/samba-autobuild/.git] / source / smbd / open.c
index 89ff9ae8096f4c1157bf77c82a7d0e883ad5c3bb..ccd12c6946d40a9755de164821cca04a0e79d8cb 100644 (file)
@@ -1650,6 +1650,15 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        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 @@ 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*.....
                 */