svn commit: samba r17127 - in branches/SAMBA_3_0_23/source/smbd: .
jra at samba.org
jra at samba.org
Wed Jul 19 01:30:23 GMT 2006
Author: jra
Date: 2006-07-19 01:30:21 +0000 (Wed, 19 Jul 2006)
New Revision: 17127
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17127
Log:
Missed a logic error in my last patch. Ensure we deal with any
oplocks that were granted when we had released the lock. Fix
strange case where stat open grants a batch oplock on file
create, but grants no oplock on file open.
Jeremy.
Modified:
branches/SAMBA_3_0_23/source/smbd/open.c
Changeset:
Modified: branches/SAMBA_3_0_23/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0_23/source/smbd/open.c 2006-07-19 00:13:36 UTC (rev 17126)
+++ branches/SAMBA_3_0_23/source/smbd/open.c 2006-07-19 01:30:21 UTC (rev 17127)
@@ -619,8 +619,11 @@
BOOL delay_it = False;
BOOL have_level2 = False;
+ if (oplock_request & INTERNAL_OPEN_ONLY) {
+ fsp->oplock_type = NO_OPLOCK;
+ }
+
if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) {
- fsp->oplock_type = NO_OPLOCK;
return False;
}
@@ -1579,10 +1582,46 @@
return NULL;
}
+ /*
+ * The share entry is again *locked*.....
+ */
+
+ /* First pass - send break only on batch oplocks. */
+ if (delay_for_oplocks(lck, fsp, 1, oplock_request)) {
+ schedule_defer_open(lck, request_time);
+ fd_close(conn, fsp);
+ file_free(fsp);
+ TALLOC_FREE(lck);
+ set_saved_ntstatus(NT_STATUS_SHARING_VIOLATION);
+ return NULL;
+ }
+
status = open_mode_check(conn, fname, lck,
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);
+ fd_close(conn, fsp);
+ file_free(fsp);
+ TALLOC_FREE(lck);
+ set_saved_ntstatus(NT_STATUS_SHARING_VIOLATION);
+ return NULL;
+ }
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
+ /* DELETE_PENDING is not deferred for a second */
+ fd_close(conn, fsp);
+ file_free(fsp);
+ TALLOC_FREE(lck);
+ set_saved_ntstatus(status);
+ return NULL;
+ }
+
if (!NT_STATUS_IS_OK(status)) {
struct deferred_open_record state;
@@ -1606,10 +1645,6 @@
return NULL;
}
- /*
- * The share entry is again *locked*.....
- */
-
/* note that we ignore failure for the following. It is
basically a hack for NFS, and NFS will never set one of
these only read them. Nobody but Samba can ever set a deny
@@ -1649,6 +1684,11 @@
fsp->access_mask = access_mask;
if (file_existed) {
+ /* stat opens on existing files don't get oplocks. */
+ if (is_stat_open(fsp->access_mask)) {
+ fsp->oplock_type = NO_OPLOCK;
+ }
+
if (!(flags2 & O_TRUNC)) {
info = FILE_WAS_OPENED;
} else {
More information about the samba-cvs
mailing list