Skip to content

Commit c5b7a24

Browse files
author
Andreas Gruenbacher
committed
gfs2: Only defer deletes when we have an iopen glock
The mechanism to defer deleting unlinked inodes is tied to delete_work_func(), which is tied to iopen glocks. When we don't have an iopen glock, we must carry out deletes immediately instead. Fixes a NULL pointer dereference in gfs2_evict_inode(). Fixes: 8c21c2c ("gfs2: Call gfs2_queue_verify_delete from gfs2_evict_inode") Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent b6900ce commit c5b7a24

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/gfs2/super.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,10 +1503,13 @@ static void gfs2_evict_inode(struct inode *inode)
15031503
!test_bit(SDF_KILL, &sdp->sd_flags)) {
15041504
struct gfs2_glock *io_gl = ip->i_iopen_gh.gh_gl;
15051505

1506-
gfs2_glock_hold(io_gl);
1507-
if (!gfs2_queue_verify_delete(io_gl, true))
1508-
gfs2_glock_put(io_gl);
1509-
goto out;
1506+
if (io_gl) {
1507+
gfs2_glock_hold(io_gl);
1508+
if (!gfs2_queue_verify_delete(io_gl, true))
1509+
gfs2_glock_put(io_gl);
1510+
goto out;
1511+
}
1512+
behavior = EVICT_SHOULD_DELETE;
15101513
}
15111514
if (behavior == EVICT_SHOULD_DELETE)
15121515
ret = evict_unlinked_inode(inode);

0 commit comments

Comments
 (0)