diff options
author | Jeremy Allison <jra@samba.org> | 2002-03-13 20:28:19 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-03-13 20:28:19 +0000 |
commit | 8aa9860ea2ea7f5aed4b6aa12794fffdfa81b0d0 (patch) | |
tree | c05cc6fc22cbc76084444e96206add565767f70d /source/locking | |
parent | 93389647203395da0e894c2e57348081e755884a (diff) | |
download | samba-8aa9860ea2ea7f5aed4b6aa12794fffdfa81b0d0.tar.gz samba-8aa9860ea2ea7f5aed4b6aa12794fffdfa81b0d0.tar.xz samba-8aa9860ea2ea7f5aed4b6aa12794fffdfa81b0d0.zip |
include/smb_macros.h: Don't round up an allocation if the size is zero.
"One of these locks is not like the others... One of these locks is not
quite the same" :-). When is a zero timeout lock not zero ? When it's
being processed by Windows 2000 of course.. This code change, ugly though
it is - completely fixes the foxpro/access multi-user file system database
problems that people have been having. I used a *wonderful* test program
donated by "Gerald Drouillard" <gerald@drouillard.ca> which allowed me
to completely reproduce this problem, and to finally determine the correct
fix. This also explains why Windows 2000 is *so slow* when responding to
the smbtorture lock tests. I *love* it when all these things come together
and finally make sense :-).
Jeremy.
Diffstat (limited to 'source/locking')
-rw-r--r-- | source/locking/locking.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/source/locking/locking.c b/source/locking/locking.c index dd6ca62e704..8f3e4a278e1 100644 --- a/source/locking/locking.c +++ b/source/locking/locking.c @@ -97,7 +97,7 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn, Utility function called by locking requests. ****************************************************************************/ -NTSTATUS do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, +static NTSTATUS do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, SMB_BIG_UINT count,SMB_BIG_UINT offset,enum brl_type lock_type) { NTSTATUS status; @@ -142,6 +142,30 @@ NTSTATUS do_lock(files_struct *fsp,connection_struct *conn, uint16 lock_pid, } /**************************************************************************** + Utility function called by locking requests. This is *DISGISTING*. It also + appears to be "What Windows Does" (tm). Andrew, ever wonder why Windows 2000 + is so slow on the locking tests...... ? This is the reason. Much though I hate + it, we need this. JRA. +****************************************************************************/ + +NTSTATUS do_lock_spin(files_struct *fsp,connection_struct *conn, uint16 lock_pid, + SMB_BIG_UINT count,SMB_BIG_UINT offset,enum brl_type lock_type) +{ + int j, maxj = lp_lock_spin_count(); + int sleeptime = lp_lock_sleep_time(); + NTSTATUS status; + + for (j = 0; j < maxj; j++) { + status = do_lock(fsp, conn, lock_pid, count, offset, lock_type); + if (!NT_STATUS_EQUAL(status, NT_STATUS_LOCK_NOT_GRANTED) && + !NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) + break; + usleep(sleeptime); + } + return status; +} + +/**************************************************************************** Utility function called by unlocking requests. ****************************************************************************/ |