diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-08-12 00:14:12 +0200 |
---|---|---|
committer | Jeff Layton <jlayton@primarydata.com> | 2014-08-14 16:07:47 +0200 |
commit | 2dfb928f7e5977a3faac943c134bbda5ae492629 (patch) | |
tree | e67a1dbe831cdad50617474427bdb3d8424ab966 /fs/locks.c | |
parent | locks: defer freeing locks in locks_delete_lock until after i_lock has been d... (diff) | |
download | linux-2dfb928f7e5977a3faac943c134bbda5ae492629.tar.xz linux-2dfb928f7e5977a3faac943c134bbda5ae492629.zip |
locks: move locks_free_lock calls in do_fcntl_add_lease outside spinlock
There's no need to call locks_free_lock here while still holding the
i_lock. Defer that until the lock has been dropped.
Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/locks.c b/fs/locks.c index 4ce087cca501..cb66fb05ad4a 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1761,13 +1761,10 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) ret = fl; spin_lock(&inode->i_lock); error = __vfs_setlease(filp, arg, &ret); - if (error) { - spin_unlock(&inode->i_lock); - locks_free_lock(fl); - goto out_free_fasync; - } - if (ret != fl) - locks_free_lock(fl); + if (error) + goto out_unlock; + if (ret == fl) + fl = NULL; /* * fasync_insert_entry() returns the old entry if any. @@ -1779,9 +1776,10 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) new = NULL; error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); +out_unlock: spin_unlock(&inode->i_lock); - -out_free_fasync: + if (fl) + locks_free_lock(fl); if (new) fasync_free(new); return error; |