Skip to content

Commit 03ff378

Browse files
author
Andreas Gruenbacher
committed
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 <[email protected]>
1 parent 70cddf1 commit 03ff378

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
@@ -1486,6 +1486,7 @@ static void gfs2_evict_inode(struct inode *inode)
14861486
enum evict_behavior behavior;
14871487
int ret;
14881488

1489+
gfs2_holder_mark_uninitialized(&gh);
14891490
if (inode->i_nlink || sb_rdonly(sb) || !ip->i_no_addr)
14901491
goto out;
14911492

@@ -1497,7 +1498,6 @@ static void gfs2_evict_inode(struct inode *inode)
14971498
if (!sdp->sd_jdesc)
14981499
goto out;
14991500

1500-
gfs2_holder_mark_uninitialized(&gh);
15011501
behavior = evict_should_delete(inode, &gh);
15021502
if (behavior == EVICT_SHOULD_DEFER_DELETE &&
15031503
!test_bit(SDF_KILL, &sdp->sd_flags)) {
@@ -1516,11 +1516,11 @@ static void gfs2_evict_inode(struct inode *inode)
15161516
if (gfs2_rs_active(&ip->i_res))
15171517
gfs2_rs_deltree(&ip->i_res);
15181518

1519-
if (gfs2_holder_initialized(&gh))
1520-
gfs2_glock_dq_uninit(&gh);
15211519
if (ret && ret != GLR_TRYFAILED && ret != -EROFS)
15221520
fs_warn(sdp, "gfs2_evict_inode: %d\n", ret);
15231521
out:
1522+
if (gfs2_holder_initialized(&gh))
1523+
gfs2_glock_dq_uninit(&gh);
15241524
truncate_inode_pages_final(&inode->i_data);
15251525
if (ip->i_qadata)
15261526
gfs2_assert_warn(sdp, ip->i_qadata->qa_ref == 0);

0 commit comments

Comments
 (0)