locks: set fl_owner for leases to filp instead of current->files
authorJeff Layton <jlayton@primarydata.com>
Mon, 1 Sep 2014 23:04:48 +0000 (19:04 -0400)
committerJeff Layton <jlayton@primarydata.com>
Tue, 7 Oct 2014 18:06:13 +0000 (14:06 -0400)
Like flock locks, leases are owned by the file description. Now that the
i_have_this_lease check in __break_lease is gone, we don't actually use
the fl_owner for leases for anything. So, it's now safe to set this more
appropriately to the same value as the fl_file.

While we're at it, fix up the comments over the fl_owner_t definition
since they're rather out of date.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
fs/locks.c
include/linux/fs.h

index aed4a95..314135a 100644 (file)
@@ -465,7 +465,7 @@ static int lease_init(struct file *filp, long type, struct file_lock *fl)
        if (assign_type(fl, type) != 0)
                return -EINVAL;
 
-       fl->fl_owner = current->files;
+       fl->fl_owner = filp;
        fl->fl_pid = current->tgid;
 
        fl->fl_file = filp;
index ed4e189..bb9484a 100644 (file)
@@ -851,13 +851,7 @@ static inline struct file *get_file(struct file *f)
  */
 #define FILE_LOCK_DEFERRED 1
 
-/*
- * The POSIX file lock owner is determined by
- * the "struct files_struct" in the thread group
- * (or NULL for no owner - BSD locks).
- *
- * Lockd stuffs a "host" pointer into this.
- */
+/* legacy typedef, should eventually be removed */
 typedef void *fl_owner_t;
 
 struct file_lock_operations {