diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2024-10-04 14:10:47 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2024-11-05 12:39:29 +0100 |
commit | 03ff3781bf6c149554d88e7b702a3abd5e400dc0 (patch) | |
tree | 476cb9bb8f00ba380366a0f6e366ca533ca9d8c3 /fs/gfs2 | |
parent | 70cddf16cbfbb6f7fb4d68bb62765850a921450d (diff) | |
download | linux-03ff3781bf6c149554d88e7b702a3abd5e400dc0.tar.gz linux-03ff3781bf6c149554d88e7b702a3abd5e400dc0.tar.bz2 linux-03ff3781bf6c149554d88e7b702a3abd5e400dc0.zip |
gfs2: gfs2_evict_inode clarification
When function evict_should_delete() returns SHOULD_DEFER_EVICTION, gh is
never initialized, but that isn't obvious; if it did initialize gh and
then return SHOULD_DEFER_EVICTION, gfs2_evict_inode() would fail to
release it. To clarify the code, change gfs2_evict_inode() to always
check if gh needs to be released, no matter what evict_should_delete()
returns.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/super.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 40158396e8db..aadb83e38c17 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -1486,6 +1486,7 @@ static void gfs2_evict_inode(struct inode *inode) enum evict_behavior behavior; int ret; + gfs2_holder_mark_uninitialized(&gh); if (inode->i_nlink || sb_rdonly(sb) || !ip->i_no_addr) goto out; @@ -1497,7 +1498,6 @@ static void gfs2_evict_inode(struct inode *inode) if (!sdp->sd_jdesc) goto out; - gfs2_holder_mark_uninitialized(&gh); behavior = evict_should_delete(inode, &gh); if (behavior == EVICT_SHOULD_DEFER_DELETE && !test_bit(SDF_KILL, &sdp->sd_flags)) { @@ -1516,11 +1516,11 @@ static void gfs2_evict_inode(struct inode *inode) if (gfs2_rs_active(&ip->i_res)) gfs2_rs_deltree(&ip->i_res); - if (gfs2_holder_initialized(&gh)) - gfs2_glock_dq_uninit(&gh); if (ret && ret != GLR_TRYFAILED && ret != -EROFS) fs_warn(sdp, "gfs2_evict_inode: %d\n", ret); out: + if (gfs2_holder_initialized(&gh)) + gfs2_glock_dq_uninit(&gh); truncate_inode_pages_final(&inode->i_data); if (ip->i_qadata) gfs2_assert_warn(sdp, ip->i_qadata->qa_ref == 0); |