Skip to content

Commit 2f5f7f6

Browse files
committed
gfs2: gfs2_evict_inode clarification
jira LE-12345 Rebuild_History Non-Buildable kernel-5.14.0-570.12.1.el9_6 commit-author Andreas Gruenbacher <agruenba@redhat.com> commit 03ff378 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> (cherry picked from commit 03ff378) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent e483c29 commit 2f5f7f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/gfs2/super.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,7 @@ static void gfs2_evict_inode(struct inode *inode)
15021502
enum evict_behavior behavior;
15031503
int ret;
15041504

1505+
gfs2_holder_mark_uninitialized(&gh);
15051506
if (inode->i_nlink || sb_rdonly(sb) || !ip->i_no_addr)
15061507
goto out;
15071508

@@ -1513,7 +1514,6 @@ static void gfs2_evict_inode(struct inode *inode)
15131514
if (!sdp->sd_jdesc)
15141515
goto out;
15151516

1516-
gfs2_holder_mark_uninitialized(&gh);
15171517
behavior = evict_should_delete(inode, &gh);
15181518
if (behavior == EVICT_SHOULD_DEFER_DELETE &&
15191519
!test_bit(SDF_KILL, &sdp->sd_flags)) {
@@ -1535,11 +1535,11 @@ static void gfs2_evict_inode(struct inode *inode)
15351535
if (gfs2_rs_active(&ip->i_res))
15361536
gfs2_rs_deltree(&ip->i_res);
15371537

1538-
if (gfs2_holder_initialized(&gh))
1539-
gfs2_glock_dq_uninit(&gh);
15401538
if (ret && ret != GLR_TRYFAILED && ret != -EROFS)
15411539
fs_warn(sdp, "gfs2_evict_inode: %d\n", ret);
15421540
out:
1541+
if (gfs2_holder_initialized(&gh))
1542+
gfs2_glock_dq_uninit(&gh);
15431543
truncate_inode_pages_final(&inode->i_data);
15441544
if (ip->i_qadata)
15451545
gfs2_assert_warn(sdp, ip->i_qadata->qa_ref == 0);

0 commit comments

Comments
 (0)