summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-13 20:28:19 +0000
committerJeremy Allison <jra@samba.org>2002-03-13 20:28:19 +0000
commit5e3b923124e82b1d19875746676df13cfdb0f918 (patch)
tree0ed715a7a0e2411dfb5b5a732278fc5eb9be3832 /source3/smbd
parent2001b83faa9f0438adda40ffe12fea4a3dc6a733 (diff)
downloadsamba-5e3b923124e82b1d19875746676df13cfdb0f918.tar.gz
samba-5e3b923124e82b1d19875746676df13cfdb0f918.tar.bz2
samba-5e3b923124e82b1d19875746676df13cfdb0f918.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. (This used to be commit 8aa9860ea2ea7f5aed4b6aa12794fffdfa81b0d0)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/blocking.c6
-rw-r--r--source3/smbd/reply.c12
2 files changed, 10 insertions, 8 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index bc8c54caf7..d4a53d9a6d 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -279,7 +279,7 @@ static BOOL process_lockread(blocking_lock_record *blr)
numtoread = MIN(BUFFER_SIZE-outsize,numtoread);
data = smb_buf(outbuf) + 3;
- status = do_lock( fsp, conn, SVAL(inbuf,smb_pid), (SMB_BIG_UINT)numtoread,
+ status = do_lock_spin( fsp, conn, SVAL(inbuf,smb_pid), (SMB_BIG_UINT)numtoread,
(SMB_BIG_UINT)startpos, READ_LOCK);
if (NT_STATUS_V(status)) {
if ((errno != EACCES) && (errno != EAGAIN)) {
@@ -345,7 +345,7 @@ static BOOL process_lock(blocking_lock_record *blr)
offset = IVAL(inbuf,smb_vwv3);
errno = 0;
- status = do_lock(fsp, conn, SVAL(inbuf,smb_pid), (SMB_BIG_UINT)count,
+ status = do_lock_spin(fsp, conn, SVAL(inbuf,smb_pid), (SMB_BIG_UINT)count,
(SMB_BIG_UINT)offset, WRITE_LOCK);
if (NT_STATUS_IS_ERR(status)) {
if((errno != EACCES) && (errno != EAGAIN)) {
@@ -417,7 +417,7 @@ static BOOL process_lockingX(blocking_lock_record *blr)
* request would never have been queued. JRA.
*/
errno = 0;
- status = do_lock(fsp,conn,lock_pid,count,offset,
+ status = do_lock_spin(fsp,conn,lock_pid,count,offset,
((locktype & 1) ? READ_LOCK : WRITE_LOCK));
if (NT_STATUS_IS_ERR(status)) break;
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9d5d34e410..cbcad435d2 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1545,7 +1545,7 @@ int reply_lockread(connection_struct *conn, char *inbuf,char *outbuf, int length
* for a write lock. JRA.
*/
- status = do_lock(fsp, conn, SVAL(inbuf,smb_pid),
+ status = do_lock_spin(fsp, conn, SVAL(inbuf,smb_pid),
(SMB_BIG_UINT)numtoread, (SMB_BIG_UINT)startpos, WRITE_LOCK);
if (NT_STATUS_V(status)) {
@@ -2366,7 +2366,7 @@ int reply_lock(connection_struct *conn,
DEBUG(3,("lock fd=%d fnum=%d offset=%.0f count=%.0f\n",
fsp->fd, fsp->fnum, (double)offset, (double)count));
- status = do_lock(fsp, conn, SVAL(inbuf,smb_pid), count, offset, WRITE_LOCK);
+ status = do_lock_spin(fsp, conn, SVAL(inbuf,smb_pid), count, offset, WRITE_LOCK);
if (NT_STATUS_V(status)) {
if (lp_blocking_locks(SNUM(conn))) {
/*
@@ -3808,6 +3808,7 @@ no oplock granted on this file (%s).\n", fsp->fnum, fsp->fsp_name));
}
/* Setup the timeout in seconds. */
+
lock_timeout = ((lock_timeout == -1) ? -1 : lock_timeout/1000);
/* Now do any requested locks */
@@ -3829,10 +3830,11 @@ no oplock granted on this file (%s).\n", fsp->fnum, fsp->fsp_name));
return ERROR_DOS(ERRDOS,ERRnoaccess);
}
- DEBUG(10,("reply_lockingX: lock start=%.0f, len=%.0f for pid %u, file %s\n",
- (double)offset, (double)count, (unsigned int)lock_pid, fsp->fsp_name ));
+ DEBUG(10,("reply_lockingX: lock start=%.0f, len=%.0f for pid %u, file %s timeout = %d\n",
+ (double)offset, (double)count, (unsigned int)lock_pid,
+ (int)lock_timeout, fsp->fsp_name ));
- status = do_lock(fsp,conn,lock_pid, count,offset,
+ status = do_lock_spin(fsp,conn,lock_pid, count,offset,
((locktype & 1) ? READ_LOCK : WRITE_LOCK));
if (NT_STATUS_V(status)) {
if ((lock_timeout != 0) && lp_blocking_locks(SNUM(conn))) {