summaryrefslogtreecommitdiff
path: root/fs/gfs2
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2024-11-19 10:44:56 +0100
committerAndreas Gruenbacher <agruenba@redhat.com>2024-11-19 12:33:20 +0100
commitc5b7a2400edc458b22133d5e5394bea26eab1923 (patch)
tree6af3f65d08d4e67efbeafa09b790802a2c8c8fde /fs/gfs2
parentb6900ce15191ff9e219f1974b5db107ae02bb387 (diff)
downloadlinux-c5b7a2400edc458b22133d5e5394bea26eab1923.tar.gz
linux-c5b7a2400edc458b22133d5e5394bea26eab1923.tar.bz2
linux-c5b7a2400edc458b22133d5e5394bea26eab1923.zip
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: 8c21c2c71e66 ("gfs2: Call gfs2_queue_verify_delete from gfs2_evict_inode") Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/super.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index aadb83e38c17..92a3b6ddafdc 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1503,10 +1503,13 @@ static void gfs2_evict_inode(struct inode *inode)
!test_bit(SDF_KILL, &sdp->sd_flags)) {
struct gfs2_glock *io_gl = ip->i_iopen_gh.gh_gl;
- gfs2_glock_hold(io_gl);
- if (!gfs2_queue_verify_delete(io_gl, true))
- gfs2_glock_put(io_gl);
- goto out;
+ if (io_gl) {
+ gfs2_glock_hold(io_gl);
+ if (!gfs2_queue_verify_delete(io_gl, true))
+ gfs2_glock_put(io_gl);
+ goto out;
+ }
+ behavior = EVICT_SHOULD_DELETE;
}
if (behavior == EVICT_SHOULD_DELETE)
ret = evict_unlinked_inode(inode);