summaryrefslogtreecommitdiff
path: root/source3/smbd/process.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-07-18 01:05:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:12 -0500
commitb737f26764cce935d9482335ece11c71a96720f4 (patch)
treee2d21c8b53815c90092437b2c4dc14bf5b34e560 /source3/smbd/process.c
parent94ad8543bd27c6cbdcdaf4acf84d91438dbef28b (diff)
downloadsamba-b737f26764cce935d9482335ece11c71a96720f4.tar.gz
samba-b737f26764cce935d9482335ece11c71a96720f4.tar.bz2
samba-b737f26764cce935d9482335ece11c71a96720f4.zip
r17105: Fix the race Volker found - we had a non-locked
region between detecting a pending lock was needed and when we added the blocking lock record. Make sure that we hold the lock over all this period. Removed the old code for doing blocking locks on SMB requests that never block (the old SMBlock and friends). Discovered something interesting about the strange NT_STATUS_FILE_LOCK_CONFLICT return. If we asked for a lock with zero timeout, and we got an error of NT_STATUS_FILE_LOCK_CONFLICT, treat it as though it was a blocking lock with a timeout of 150 - 300ms. This only happens when timeout is sent as zero and can be seen quite clearly in ethereal. This is the real replacement for old do_lock_spin() code. Re-worked the blocking lock select timeout to correctly use milliseconds instead of the old second level resolution (far too coarse for this work). Jeremy. (This used to be commit b81d6d1ae95a3d3e449dde629884b565eac289d9)
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r--source3/smbd/process.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index ce352adfd7..f8c66d93ea 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1276,7 +1276,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
}
/****************************************************************************
- Setup the needed select timeout.
+ Setup the needed select timeout in milliseconds.
****************************************************************************/
static int setup_select_timeout(void)
@@ -1284,16 +1284,17 @@ static int setup_select_timeout(void)
int select_timeout;
int t;
- select_timeout = blocking_locks_timeout(SMBD_SELECT_TIMEOUT);
- select_timeout *= 1000;
+ select_timeout = blocking_locks_timeout_ms(SMBD_SELECT_TIMEOUT*1000);
t = change_notify_timeout();
DEBUG(10, ("change_notify_timeout: %d\n", t));
- if (t != -1)
+ if (t != -1) {
select_timeout = MIN(select_timeout, t*1000);
+ }
- if (print_notify_messages_pending())
+ if (print_notify_messages_pending()) {
select_timeout = MIN(select_timeout, 1000);
+ }
return select_timeout;
}
@@ -1482,7 +1483,7 @@ machine %s in domain %s.\n", global_myname(), lp_workgroup()));
* Check to see if we have any blocking locks
* outstanding on the queue.
*/
- process_blocking_lock_queue(t);
+ process_blocking_lock_queue();
/* update printer queue caches if necessary */