diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2017-08-01 11:45:23 -0500 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2017-08-10 10:45:21 -0500 |
commit | 71c1b2136835c88c231f7a5e3dc618f7568f84f7 (patch) | |
tree | 73a9839b924775b9e91e47a7f5a1288cc583d31c /fs/gfs2/glock.c | |
parent | eebd2e813f7ef688e22cd0b68aea78fb3d1ef19c (diff) | |
download | linux-71c1b2136835c88c231f7a5e3dc618f7568f84f7.tar.bz2 |
gfs2: gfs2_evict_inode: Put glocks asynchronously
gfs2_evict_inode is called to free inodes under memory pressure. The
function calls into DLM when an inode's last cluster-wide reference goes
away (remote unlink) and to release the glock and associated DLM lock
before finally destroying the inode. However, if DLM is blocked on
memory to become available, calling into DLM again will deadlock.
Avoid that by decoupling releasing glocks from destroying inodes in that
case: with gfs2_glock_queue_put, glocks will be dequeued asynchronously
in work queue context, when the associated inodes have likely already
been destroyed.
With this change, inodes can end up being unlinked, remote-unlink can be
triggered, and then the inode can be reallocated before all
remote-unlink callbacks are processed. To detect that, revalidate the
link count in gfs2_evict_inode to make sure we're not deleting an
allocated, referenced inode.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 11d48b964047..5ad757f0ce60 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -171,7 +171,7 @@ void gfs2_glock_free(struct gfs2_glock *gl) * */ -static void gfs2_glock_hold(struct gfs2_glock *gl) +void gfs2_glock_hold(struct gfs2_glock *gl) { GLOCK_BUG_ON(gl, __lockref_is_dead(&gl->gl_lockref)); lockref_get(&gl->gl_lockref); @@ -264,6 +264,14 @@ static void __gfs2_glock_put(struct gfs2_glock *gl) sdp->sd_lockstruct.ls_ops->lm_put_lock(gl); } +/* + * Cause the glock to be put in work queue context. + */ +void gfs2_glock_queue_put(struct gfs2_glock *gl) +{ + gfs2_glock_queue_work(gl, 0); +} + /** * gfs2_glock_put() - Decrement reference count on glock * @gl: The glock to put |