Skip to content

Commit 7c6f714

Browse files
author
Andreas Gruenbacher
committed
gfs2: Fix unlinked inode cleanup
Before commit f0e56ed ("gfs2: Split the two kinds of glock "delete" work"), function delete_work_func() was used to trigger the eviction of in-memory inodes from remote as well as deleting unlinked inodes at a later point. These two kinds of work were then split into two kinds of work, and the two places in the code were deferred deletion of inodes is required accidentally ended up queuing the wrong kind of work. This caused unlinked inodes to be left behind, which could in the worst case fill up filesystems and require a filesystem check to recover. Fix that by queuing the right kind of work in try_rgrp_unlink() and gfs2_drop_inode(). Fixes: f0e56ed ("gfs2: Split the two kinds of glock "delete" work") Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 160bc95 commit 7c6f714

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

fs/gfs2/glock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ bool gfs2_queue_try_to_evict(struct gfs2_glock *gl)
10121012
&gl->gl_delete, 0);
10131013
}
10141014

1015-
static bool gfs2_queue_verify_delete(struct gfs2_glock *gl, bool later)
1015+
bool gfs2_queue_verify_delete(struct gfs2_glock *gl, bool later)
10161016
{
10171017
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
10181018
unsigned long delay;

fs/gfs2/glock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ static inline int gfs2_glock_nq_init(struct gfs2_glock *gl,
245245
void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state);
246246
void gfs2_glock_complete(struct gfs2_glock *gl, int ret);
247247
bool gfs2_queue_try_to_evict(struct gfs2_glock *gl);
248+
bool gfs2_queue_verify_delete(struct gfs2_glock *gl, bool later);
248249
void gfs2_cancel_delete_work(struct gfs2_glock *gl);
249250
void gfs2_flush_delete_work(struct gfs2_sbd *sdp);
250251
void gfs2_gl_hash_clear(struct gfs2_sbd *sdp);

fs/gfs2/rgrp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip
18791879
*/
18801880
ip = gl->gl_object;
18811881

1882-
if (ip || !gfs2_queue_try_to_evict(gl))
1882+
if (ip || !gfs2_queue_verify_delete(gl, false))
18831883
gfs2_glock_put(gl);
18841884
else
18851885
found++;

fs/gfs2/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ static int gfs2_drop_inode(struct inode *inode)
10451045
struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl;
10461046

10471047
gfs2_glock_hold(gl);
1048-
if (!gfs2_queue_try_to_evict(gl))
1048+
if (!gfs2_queue_verify_delete(gl, true))
10491049
gfs2_glock_put_async(gl);
10501050
return 0;
10511051
}

0 commit comments

Comments
 (0)