[OpenAFS-devel] linux-and-locks-cleanup-20070202 crashes linux kernels older than 2.6.17 (see RT #53457)

Jeffrey Hutzelman jhutz@cmu.edu
Fri, 09 Feb 2007 12:29:54 -0500


On Thursday, February 08, 2007 05:54:55 PM -0500 Marcus Watts 
<mdw@umich.edu> wrote:

> phase 2 "soon".  Fileserver only does whole-file locking.
> 	All clients support "generic" local byte-range locking,
> 	backed up by serverside whole-file locking and
> 	some sort of simplistic file flushing when a write
> 	lock is released.

I think this is rather harder than you or Matt suspect.  The problem with 
backing local byte-range locks by whole-file locks on the server is that to 
do it safely, the lock you get on the server has to be at least as good as 
the local lock, and there's no way to atomically upgrade and downgrade 
locks on the server.  That effectively means that all locks need to be 
backed by exclusive locks on the server, since you can have this scenario:

- process A gets whole-file read lock
- process B gets partial-file read lock
- process A releases its lock
- process C gets partial-file write lock, not conflicting with B's.

When process C gets its lock, you need to upgrade to a write lock, but you 
cannot do so without first giving up process B's lock.

-- Jeff