Skip to content

Commit

Permalink
locks: set fl_owner for leases back to current->files
Browse files Browse the repository at this point in the history
This fixes a regression due to commit 130d1f9 (locks: ensure that
fl_owner is always initialized properly in flock and lease codepaths). I
had mistakenly thought that the fl_owner wasn't used in the lease code,
but I missed the place in __break_lease that does use it.

The i_have_this_lease check in generic_add_lease uses it. While I'm not
sure that check is terribly helpful [1], reset it back to using
current->files in order to ensure that there's no behavior change here.

[1]: leases are owned by the file description. It's possible that this
     is a threaded program, and the lease breaker and the task that
     would handle the signal are different, even if they have the same
     file table. So, there is the potential for false positives with
     this check.

Fixes: 130d1f9 (locks: ensure that fl_owner is always initialized properly in flock and lease codepaths)
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
  • Loading branch information
Jeff Layton committed Jun 10, 2014
1 parent 962bd40 commit 0c27362
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,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 = (fl_owner_t)filp;
fl->fl_owner = (fl_owner_t)current->files;
fl->fl_pid = current->tgid;

fl->fl_file = filp;
Expand Down

0 comments on commit 0c27362

Please sign in to comment.