summaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorMarc Eshel <eshel@almaden.ibm.com>2007-01-18 23:52:58 +0100
committerJ. Bruce Fields <bfields@citi.umich.edu>2007-05-07 02:38:28 +0200
commit9b9d2ab4154a42ea4a119f7d3e4e0288bfe0bb79 (patch)
tree62af6b2eff0885c26aa2af4b01890cc02cf0b2f0 /fs/locks.c
parentlocks: allow {vfs,posix}_lock_file to return conflicting lock (diff)
downloadlinux-9b9d2ab4154a42ea4a119f7d3e4e0288bfe0bb79.tar.xz
linux-9b9d2ab4154a42ea4a119f7d3e4e0288bfe0bb79.zip
locks: add lock cancel command
Lock managers need to be able to cancel pending lock requests. In the case where the exported filesystem manages its own locks, it's not sufficient just to call posix_unblock_lock(); we need to let the filesystem know what's happening too. We do this by adding a new fcntl lock command: FL_CANCELLK. Some day this might also be made available to userspace applications that could benefit from an asynchronous locking api. Signed-off-by: Marc Eshel <eshel@almaden.ibm.com> Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/locks.c b/fs/locks.c
index ee46584c1a40..242328e17f32 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2028,6 +2028,22 @@ posix_unblock_lock(struct file *filp, struct file_lock *waiter)
EXPORT_SYMBOL(posix_unblock_lock);
+/**
+ * vfs_cancel_lock - file byte range unblock lock
+ * @filp: The file to apply the unblock to
+ * @fl: The lock to be unblocked
+ *
+ * Used by lock managers to cancel blocked requests
+ */
+int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
+{
+ if (filp->f_op && filp->f_op->lock)
+ return filp->f_op->lock(filp, F_CANCELLK, fl);
+ return 0;
+}
+
+EXPORT_SYMBOL_GPL(vfs_cancel_lock);
+
static void lock_get_status(char* out, struct file_lock *fl, int id, char *pfx)
{
struct inode *inode = NULL;