diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-12-19 12:03:17 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-12-19 12:03:17 +0000 |
commit | 263036a798b4c431f03dae20d33f90585d2b0cab (patch) | |
tree | 1a8af7fae50ac0b81fb0da9149b1eb92fb2706b0 /source3/smbd | |
parent | e0672ae29bcd345bdf0fec96844f658ffd941039 (diff) | |
parent | f87da49830960aebe4ffa551e7e1f16330d28cca (diff) | |
download | samba-263036a798b4c431f03dae20d33f90585d2b0cab.tar.gz samba-263036a798b4c431f03dae20d33f90585d2b0cab.tar.bz2 samba-263036a798b4c431f03dae20d33f90585d2b0cab.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into pyregistry
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/oplock.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index c98d11426d..261d8fd670 100644 --- a/source3/smbd/oplock.c +++ b/source3/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 #5980. + */ + + 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 |