posix locking and the brlock database

tridge at samba.org tridge at samba.org
Sat May 19 09:43:53 GMT 2007


I just came across what I think is a generic problem with the Samba3
brlock code. 

Imagine you have "posix locking = yes", and a NFS client or local unix
app has a file locked for a short time.

While the file is locked, a windows client tries to get the lock. It
will check the posix lock in brlock.c, and see that it can't get the
lock, so it puts in a pending lock entry in the brlock.tdb record for
that file.

Then the NFS client or local unix application releases the byte range
lock. What triggers the retry of the pending lock? We don't get any
notification from the kernel, and we don't retry internally.

This is only a problem for timed locks with long timeouts of
course. They aren't common, but it would be nice to handle them.

Perhaps we need a timer which re-scans our pending lock list and
retries those that were denied by posix locks at regular
intervals. Maybe once every 10 seconds or so.

Cheers, Tridge

More information about the samba-technical mailing list