]> git.baikalelectronics.ru Git - kernel.git/commit
locks: defer freeing locks in locks_delete_lock until after i_lock has been dropped
authorJeff Layton <jlayton@primarydata.com>
Mon, 11 Aug 2014 18:20:31 +0000 (14:20 -0400)
committerJeff Layton <jlayton@primarydata.com>
Thu, 14 Aug 2014 14:07:47 +0000 (10:07 -0400)
commitea33f916d42d60334d18fac4f037d949d3554997
tree445d69a6adf6a9f9aaedd118f714c07abc96ba1b
parentce4a921ca4e0c67e80d842214f04ba3230381ea4
locks: defer freeing locks in locks_delete_lock until after i_lock has been dropped

In commit 823f3d8f2d069 (locks: turn lock_flocks into a spinlock), we
moved from using the BKL to a global spinlock. With this change, we lost
the ability to block in the fl_release_private operation.

This is problematic for NFS (and probably some other filesystems as
well). Add a new list_head argument to locks_delete_lock. If that
argument is non-NULL, then queue any locks that we want to free to the
list instead of freeing them.

Then, add a new locks_dispose_list function that will walk such a list
and call locks_free_lock on them after the i_lock has been dropped.

Finally, change all of the callers of locks_delete_lock to pass in a
list_head, except for lease_modify. That function can be called long
after the i_lock has been acquired. Deferring the freeing of a lease
after unlocking it in that function is non-trivial until we overhaul
some of the spinlocking in the lease code.

Currently though, no filesystem that sets fl_release_private supports
leases, so this is not currently a problem. We'll eventually want to
make the same change in the lease code, but it needs a lot more work
before we can reasonably do so.

Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
fs/locks.c