Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9b9d2ab4154a42ea4a119f7d3e4e0288bfe0bb79
Commit:     9b9d2ab4154a42ea4a119f7d3e4e0288bfe0bb79
Parent:     150b393456e5a23513cace286a019e87151e47f0
Author:     Marc Eshel <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 18 17:52:58 2007 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Sun May 6 20:38:28 2007 -0400

    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 <[EMAIL PROTECTED]>
    Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
---
 fs/locks.c            |   16 ++++++++++++++++
 include/linux/fcntl.h |    4 ++++
 include/linux/fs.h    |    1 +
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index ee46584..242328e 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;
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 996f561..40b9326 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -3,6 +3,10 @@
 
 #include <asm/fcntl.h>
 
+/* Cancel a blocking posix lock; internal use only until we expose an
+ * asynchronous lock api to userspace: */
+#define F_CANCELLK     (F_LINUX_SPECIFIC_BASE+5)
+
 #define F_SETLEASE     (F_LINUX_SPECIFIC_BASE+0)
 #define F_GETLEASE     (F_LINUX_SPECIFIC_BASE+1)
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c92d0bd..64b8ae2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -857,6 +857,7 @@ extern int posix_lock_file_wait(struct file *, struct 
file_lock *);
 extern int posix_unblock_lock(struct file *, struct file_lock *);
 extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, 
struct file_lock *);
+extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to