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

Chaskiel M Grundman cg2v@andrew.cmu.edu
Sun, 11 Feb 2007 02:45:47 -0500 (EST)


Upon further reflection, I have decided that the clearing of FL_SLEEP was 
the result of the same poor thinking that resulted in the assert statement 
that was removed in linux-and-locks-cleanup-20070202. That is, that 
afs_lockctl will block if any blocking is needed, and that once 
afs_lockctl succeeded, then it must be the case that posix_lock_file will 
not block. This turns out to be incorrect when applications use byte-range 
locks. afs_lockctl always returns 0 (success) on such a lock request. If 
we wish to offer working intra-client byte-range locking (and I see no 
reason not to, on linux...), then any FL_SLEEP in the lock request should 
be left alone.

The FL_SLEEP masking code should be removed from both afs_linux_lock and 
afs_linux_flock. posix_lock_file should become posix_lock_file_wait on 
2.6, and the 0 should become (cmd == F_SETLKW) on 2.4 (but there are 
details to be dealt with, like the fact that old 2.6's don't have 
posix_lock_file_wait or any way to simulate it.) I will try to work up a 
patch on monday, but if someone else beats me to it, I will not complain.