[linux-cifs-client] unlocking part of a byte-range lock with CIFS
Jeremy Allison
jra at samba.org
Thu Jul 19 20:35:48 GMT 2007
On Thu, Jul 19, 2007 at 04:25:37PM -0400, Jeff Layton wrote:
> I've been testing with the connectathon tests on CIFS. With posix
> extensions everything works correctly, but without them some tests
> fail. There are probably good reasons for it, but I'm trying to
> determine what they are (mostly for my own education...)
>
> One test that fails is lock test #10. I've tracked down the cause, but
> it looks deliberate and I'm unsure of the reasoning. The test
> essentially does this on a file:
>
> fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=3}) = 0
> fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1, len=1}) = 0
>
> ...but when I look at packet traces, I only see the first request go
> out on the wire. The second one never does. Later, when a different
> process tries to lock that byte, it fails when it should succeed.
>
> The cifs_lock code has this:
>
> } else if (numUnlock) {
> /* For each stored lock that this unlock overlaps
> completely, unlock it. */
>
> ...and the code seems to make the above unlock a no-op. Why does the
> unlock need to overlap completely here? Is this some limitation of the
> CIFS protocol or is this a bug?
Limitation of CIFS locking without POSIX extensions. Non-POSIX
CIFS locks must exactly match the regions locked/unlocked - if
the regions don't lock the server has to return an error.
You have to have POSIX extensions turned on for CIFS locking
to work correctly from a POSIX client.
Jeremy.
More information about the linux-cifs-client
mailing list