]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/locks.c
locks: add fl_grant callback for asynchronous lock return
authorMarc Eshel <eshel@almaden.ibm.com>
Wed, 6 Dec 2006 04:31:28 +0000 (23:31 -0500)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Mon, 7 May 2007 00:38:49 +0000 (20:38 -0400)
commit2beb6614f5e36c6165b704c167d82ef3e4ceaa0c
tree7c5c1277f139c754d7b73a1822016574de655bd6
parentfd85b8170dabbf021987875ef7f903791f4f181e
locks: add fl_grant callback for asynchronous lock return

Acquiring a lock on a cluster filesystem may require communication with
remote hosts, and to avoid blocking lockd or nfsd threads during such
communication, we allow the results to be returned asynchronously.

When a ->lock() call needs to block, the file system will return
-EINPROGRESS, and then later return the results with a call to the
routine in the fl_grant field of the lock_manager_operations struct.

This differs from the case when ->lock returns -EAGAIN to a blocking
lock request; in that case, the filesystem calls fl_notify when the lock
is granted, and the caller retries the original lock.  So while
fl_notify is merely a hint to the caller that it should retry, fl_grant
actually communicates the final result of the lock operation (with the
lock already acquired in the succesful case).

Therefore fl_grant takes a lock, a status and, for the test lock case, a
conflicting lock.  We also allow fl_grant to return an error to the
filesystem, to handle the case where the fl_grant requests arrives after
the lock manager has already given up waiting for it.

Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/locks.c
include/linux/fs.h