[Samba] A samba locking question

Jeremy Allison jra at samba.org
Tue Feb 10 07:15:04 GMT 2004


On Tue, Feb 10, 2004 at 07:46:11AM +0100, Patrik Gustavsson wrote:
> Yes, your are wright. But Samba will not
> do a byte ranged lock using fcntl() on the file
> when lock range is below 2^31 as stated in the docs.

No, you've got it wrong (I *wrote* the mapping code). Samba checks
a lock request against the internal 64-bit unsigned locking database.

If that lock request would be granted (no other Windows locks
conflict) then it tries to map the 64-bit unsigned Windows
lock onto either (a) a 64-bit signed POSIX lock or (b) a 32-bit
signed POSIX lock (depending on what the underlying UNIX supports).

If it can also get that lock then the lock is granted, if not
then it rolls back the lock entry in the internal Windows
locking database and returns a lock error to the client.

It can be complicated by the fact there is a parameter to
tell Samba whether to map onto POSIX locks or not, and also
a client may ask for a blocking lock which may delay the
response.

Jeremy.


More information about the samba mailing list