diff options
| author | Jeff Layton <jlayton@primarydata.com> | 2014-08-11 18:14:12 -0400 |
|---|---|---|
| committer | Jeff Layton <jlayton@primarydata.com> | 2014-08-14 10:07:47 -0400 |
| commit | 2dfb928f7e5977a3faac943c134bbda5ae492629 (patch) | |
| tree | e67a1dbe831cdad50617474427bdb3d8424ab966 | |
| parent | ed9814d85810c27670987b40c77e8a07105838fe (diff) | |
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>
| -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) | |||
| 1761 | ret = fl; | 1761 | ret = fl; |
| 1762 | spin_lock(&inode->i_lock); | 1762 | spin_lock(&inode->i_lock); |
| 1763 | error = __vfs_setlease(filp, arg, &ret); | 1763 | error = __vfs_setlease(filp, arg, &ret); |
| 1764 | if (error) { | 1764 | if (error) |
| 1765 | spin_unlock(&inode->i_lock); | 1765 | goto out_unlock; |
| 1766 | locks_free_lock(fl); | 1766 | if (ret == fl) |
| 1767 | goto out_free_fasync; | 1767 | fl = NULL; |
| 1768 | } | ||
| 1769 | if (ret != fl) | ||
| 1770 | locks_free_lock(fl); | ||
| 1771 | 1768 | ||
| 1772 | /* | 1769 | /* |
| 1773 | * fasync_insert_entry() returns the old entry if any. | 1770 | * 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) | |||
| 1779 | new = NULL; | 1776 | new = NULL; |
| 1780 | 1777 | ||
| 1781 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); | 1778 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); |
| 1779 | out_unlock: | ||
| 1782 | spin_unlock(&inode->i_lock); | 1780 | spin_unlock(&inode->i_lock); |
| 1783 | 1781 | if (fl) | |
| 1784 | out_free_fasync: | 1782 | locks_free_lock(fl); |
| 1785 | if (new) | 1783 | if (new) |
| 1786 | fasync_free(new); | 1784 | fasync_free(new); |
| 1787 | return error; | 1785 | return error; |
