[linux-cifs-client] Re: unlocking part of a byte-range lock with CIFS

Steve French (smfltc) smfltc at us.ibm.com
Fri Aug 24 13:49:44 GMT 2007


Jeff Layton wrote:

>On Fri, 20 Jul 2007 10:15:43 -0500
>"Steve French (smfltc)" <smfltc at us.ibm.com> wrote:
>  
>
>>
>>lock bytes 1 through 3
>>unlock byte 2
>>would be to do
>>
>>cifs lock bytes 1 through 3
>>cifs lock 1, cifs lock 3
>>unlock bytes 1 through 3
>>
>>It would be fairly easy to emulate in lines 768 through 781 (current
>>mainline cifs) of fs/cifs/file.c   The current algorith unlocks the
>>stored (windows/cifs locks) that are within the lock request.
>>
>>    
>>
>
>I started having a look at this scheme today, and hacked up a rough
>implementation of the above logic. The problem I'm seeing is that the
>overlapping lock requests are refused with STATUS_LOCK_NOT_GRANTED. I'm
>presuming that the server (samba 3.0.25b) is refusing them since the
>range is already considered to be locked.
>
>To make this work, I do I need to make the original lock be shared
>so that overlapping locks will work? If so, that might be a bit racy...
>  
>
Is this with Unix Extensions turned on or off? To turn off Unix 
Extensions for current cifs,
mount with "nounix" or if you have older cifs "echo 0 > 
/proc/fs/cifs/LinuxExtensionsEnabled"
before the nmount.  I would expect a second lock from the same client, 
same process would
work for CIFS semantics but it has been a long time since I have tried this.

Also might be easy to code up an smbtorture test for this (see 
SAMBA_4/source/torture/basic/locking.c
especially around lines 68 through 90) to test semantics.


More information about the linux-cifs-client mailing list