summaryrefslogtreecommitdiffstats
path: root/source/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-03-31 16:46:20 -0700
committerKarolin Seeger <kseeger@bando.sernet.private>2008-04-03 10:43:04 +0200
commit0fb5b3282d50520f857f584126a33acbf866b774 (patch)
tree17192102f873665964f73bd3308df4ca5873c4df /source/smbd
parent4b40a23233a745ea80246d896d408f1e947995aa (diff)
downloadsamba-0fb5b3282d50520f857f584126a33acbf866b774.tar.gz
samba-0fb5b3282d50520f857f584126a33acbf866b774.tar.xz
samba-0fb5b3282d50520f857f584126a33acbf866b774.zip
Reduce the race condition in Samba4 in RAW-RENAME test. We rename a file
using trans2 setfileinfo on one connection, and then check the file name has changed on the other. In Samba we achieve this by sending a local message to the other process. This change causes us to re-scan for incoming messages after we've woken up from the select (which is cheap if there are no pending messages). This reduces the race significantly. Volker please review. Jeremy. (cherry picked from commit a7499e994aef743ea9c443f9a1618b262f6eda93)
Diffstat (limited to 'source/smbd')
-rw-r--r--source/smbd/process.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 9c01bbaa4a8..03216a07001 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -853,6 +853,15 @@ static NTSTATUS receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer,
goto again;
}
+ /*
+ * We've just woken up from a protentially long select sleep.
+ * Ensure we process local messages as we need to synchronously
+ * process any messages from other smbd's to avoid file rename race
+ * conditions. This call is cheap if there are no messages waiting.
+ * JRA.
+ */
+ message_dispatch(smbd_messaging_context());
+
/* if we get EINTR then maybe we have received an oplock
signal - treat this as select returning 1. This is ugly, but
is the best we can do until the oplock code knows more about