[Samba] Need some explanation on Samba/NFS locks handle

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Mar 16 15:26:05 GMT 2007


On Fri, Mar 16, 2007 at 04:15:23PM +0100, Alain.Gorlier at altissemiconductor.com wrote:
> >> What kind of lock would the NFS client issue? 
> Linux locks : /* F_RDLCK, F_WRLCK, F_UNLCK */
> 
> >> I don't know enough about NFS locking to really tell whether this is
> >> possible at all and which semantics those locks would really have.
> 
> Imagine an NFS application that has to lock a file to inform others that 
> the file is already used and should not be written (F_WRLCK).
> In samba server, there is no check/no error reported to the SMB clients 
> that the file is locked.
> So a samba client can always access/write the file that is already used 
> and locked by an NFS client.
> 
> >> Does this work across different NFS clients? And if yes, which syscall 
> are used there?
> The application has to be written to handle locks correctly. fcntl 
> function ?
> 
> Do I miss something ?

Yes :-)

The locks you are talking about are byte-range locks. The
code snipped you have pasted was from our file-open code
which does not care about byte range locking.

Byte-Range locks are handled correctly cross-platform. But
be aware that many NFS implementations have problems with
byte range locking. The cross-platform locking can be turned
off via the 'posix locking' smb.conf parameter if you wish
so.

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba/attachments/20070316/dbb0dd60/attachment.bin


More information about the samba mailing list