posix locking and the brlock database

Jeremy Allison jra at samba.org
Sat May 19 18:02:14 GMT 2007

On Sat, May 19, 2007 at 07:43:53PM +1000, tridge at samba.org wrote:
> Volker,
> 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.

Errr, we used to do this. I knew about this problem when
I first wrote the locking code and added such a scanner
(and it was every 10 seconds).

Has this scan been lost ?

If so I can now more easily retry it as we know if it's 
a lock that was blocked by POSIX not Windows (for which
we'll get a message).


More information about the samba-technical mailing list