lockd: handle test_lock deferrals
authorMarc Eshel <eshel@almaden.ibm.com>
Tue, 28 Nov 2006 21:27:06 +0000 (16:27 -0500)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Mon, 7 May 2007 00:38:50 +0000 (20:38 -0400)
commit5ea0d75037b93baa453b4d326c6319968fe91cea
tree661d15750a689daec2dca0f81a16c75a930df741
parent85f3f1b3f7a6197b51a2ab98d927517df730214c
lockd: handle test_lock deferrals

Rewrite nlmsvc_testlock() to use the new asynchronous interface: instead of
immediately doing a posix_test_lock(), we first look for a matching block.
If the subsequent test_lock returns anything other than -EINPROGRESS, we
then remove the block we've found and return the results.

If it returns -EINPROGRESS, then we defer the lock request.

In the case where the block we find in the first step has B_QUEUED set,
we bypass the vfs_test_lock entirely, instead using the block to decide how
to respond:
with nlm_lck_denied if B_TIMED_OUT is set.
with nlm_granted if B_GOT_CALLBACK is set.
by dropping if neither B_TIMED_OUT nor B_GOT_CALLBACK is set

Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/lockd/svc4proc.c
fs/lockd/svclock.c
fs/lockd/svcproc.c