[linux-cifs-client] Re: Bug in cifsfs POSIX locking client code.
Jeremy Allison
jra at samba.org
Thu Jul 13 00:26:08 GMT 2006
On Wed, Jul 12, 2006 at 03:38:46PM -0700, Jeremy Allison wrote:
> >
> > The second patch is to add timeout values to the set
> > posix fcntl lock call. It sets this in the same way as
> > you do for the Windows lockingX call. Unfortunately it
> > doesn't seem to make a difference. The client still seems
> > to be arbitrarily disconnecting from the server (I'm getting
The second patch was buggy, I forgot to set the pSMB->Timeout
value to -1 (as is done in the normal lock case).
Here's the corrected patch for cifssmb.c
Jeremy.
-------------- next part --------------
--- cifssmb.c.orig 2006-07-11 22:23:34.000000000 -0700
+++ cifssmb.c 2006-07-12 16:54:15.000000000 -0700
@@ -1373,6 +1373,7 @@
struct cifs_posix_lock *parm_data;
int rc = 0;
int bytes_returned = 0;
+ int timeout = 0;
__u16 params, param_offset, offset, byte_count, count;
cFYI(1, ("Posix Lock"));
@@ -1413,8 +1414,11 @@
(((char *) &pSMB->hdr.Protocol) + offset);
parm_data->lock_type = cpu_to_le16(lock_type);
- if(waitFlag)
+ if(waitFlag) {
+ timeout = 3; /* blocking operation, no timeout */
parm_data->lock_flags = 1;
+ pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
+ }
parm_data->pid = cpu_to_le32(current->tgid);
parm_data->start = lkoffset;
parm_data->length = len; /* normalize negative numbers */
@@ -1426,7 +1430,7 @@
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
- (struct smb_hdr *) pSMBr, &bytes_returned, 0);
+ (struct smb_hdr *) pSMBr, &bytes_returned, timeout);
if (rc) {
cFYI(1, ("Send error in Posix Lock = %d", rc));
}
More information about the linux-cifs-client
mailing list