]> git.hungrycats.org Git - linux/commitdiff
[PATCH] nfs4 lease: add a lock manager break callback
authorWilliam A. Adamson <andros@thnk.citi.umich.edu>
Wed, 20 Oct 2004 01:43:51 +0000 (18:43 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 20 Oct 2004 01:43:51 +0000 (18:43 -0700)
- Add a lock manager break callback to break_lease() for lock managers to
  initiate breaking a lease.

- Move the break_lease() kill_fasync() call to a default lock manager
  fl_break callback

Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/locks.c
include/linux/fs.h

index caa9b466cd91223842e30f296ca0afdb23e2329b..70a3df0d930d9ba5706a75c11a75a06cc7256eb8 100644 (file)
@@ -391,6 +391,16 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
 }
 #endif
 
+/* default lease lock manager operations */
+static void lease_break_callback(struct file_lock *fl)
+{
+       kill_fasync(&fl->fl_fasync, SIGIO, POLL_MSG);
+}
+
+struct lock_manager_operations lease_manager_ops = {
+       .fl_break = lease_break_callback,
+};
+
 /* Allocate a file_lock initialised to this type of lease */
 static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
 {
@@ -1127,7 +1137,10 @@ int __break_lease(struct inode *inode, unsigned int mode)
                if (fl->fl_type != future) {
                        fl->fl_type = future;
                        fl->fl_break_time = break_time;
-                       kill_fasync(&fl->fl_fasync, SIGIO, POLL_MSG);
+                       if (fl->fl_lmops && fl->fl_lmops->fl_break)
+                               fl->fl_lmops->fl_break(fl);
+                       else    /* lease must have lmops break callback */
+                               BUG();
                }
        }
 
index 2177ae5629270284da115fdc0e0647458617447c..9e9befdd028952fb59bc038fddde5e41b1b02336 100644 (file)
@@ -635,6 +635,7 @@ struct lock_manager_operations {
        void (*fl_notify)(struct file_lock *);  /* unblock callback */
        void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
        void (*fl_release_private)(struct file_lock *);
+       void (*fl_break)(struct file_lock *);
 };
 
 /* that will die - we need it for nfs_lock_info */