[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4718-g61ec751

Jeremy Allison jra at samba.org
Thu Dec 18 21:29:02 GMT 2008


The branch, v3-3-test has been updated
       via  61ec751fe3560b47681d414506eca934786e122d (commit)
      from  da1852f65188efc559738c2e5da295b702ad4619 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 61ec751fe3560b47681d414506eca934786e122d
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Dec 18 13:28:09 2008 -0800

    Fix bug #5980 - Race condition when granting level2 oplocks can cause break notify to be missed.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/oplock.c |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c
index c98d114..4b3ab96 100644
--- a/source/smbd/oplock.c
+++ b/source/smbd/oplock.c
@@ -821,10 +821,33 @@ void release_level_2_oplocks_on_change(files_struct *fsp)
 
 		share_mode_entry_to_message(msg, share_entry);
 
-		messaging_send_buf(smbd_messaging_context(), share_entry->pid,
-				   MSG_SMB_ASYNC_LEVEL2_BREAK,
-				   (uint8 *)msg,
-				   MSG_SMB_SHARE_MODE_ENTRY_SIZE);
+		/*
+		 * Deal with a race condition when breaking level2
+ 		 * oplocks. Don't send all the messages and release
+ 		 * the lock, this allows someone else to come in and
+ 		 * get a level2 lock before any of the messages are
+ 		 * processed, and thus miss getting a break message.
+ 		 * Ensure at least one entry (the one we're breaking)
+ 		 * is processed immediately under the lock and becomes
+ 		 * set as NO_OPLOCK to stop any waiter getting a level2.
+ 		 * Bugid #5979.
+ 		 */
+
+		if (procid_is_me(&share_entry->pid)) {
+			DATA_BLOB blob = data_blob_const(msg,
+					MSG_SMB_SHARE_MODE_ENTRY_SIZE);
+			process_oplock_async_level2_break_message(smbd_messaging_context(),
+						NULL,
+						MSG_SMB_ASYNC_LEVEL2_BREAK,
+						share_entry->pid,
+						&blob);
+		} else {
+			messaging_send_buf(smbd_messaging_context(),
+					share_entry->pid,
+					MSG_SMB_ASYNC_LEVEL2_BREAK,
+					(uint8 *)msg,
+					MSG_SMB_SHARE_MODE_ENTRY_SIZE);
+		}
 	}
 
 	/* We let the message receivers handle removing the oplock state


-- 
Samba Shared Repository


More information about the samba-cvs mailing list