]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gfs2: minor evict fix
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 3 Mar 2025 10:28:23 +0000 (11:28 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 10 Mar 2025 17:15:38 +0000 (18:15 +0100)
In evict_should_delete(), when gfs2_upgrade_iopen_glock() fails, we
detach the iopen glock from the inode without calling
glock_clear_object().  This leads to a warning in glock_set_object()
when the same inode is recreated and the glock is reused.
Fix that by only detaching the iopen glock in gfs2_evict_inode().

In addition, remove the dequeue code from evict_should_delete(); we
already perform a conditional dequeue in gfs2_evict_inode().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/super.c

index bd2bdcd2879ced1771bab76c48df11d10fd23a5a..28d67131ad79fd0ac5df2fa9f014cf6cdde43be4 100644 (file)
@@ -1339,12 +1339,8 @@ static enum evict_behavior evict_should_delete(struct inode *inode,
 
        /* Must not read inode block until block type has been verified */
        ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, gh);
-       if (unlikely(ret)) {
-               glock_clear_object(ip->i_iopen_gh.gh_gl, ip);
-               ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
-               gfs2_glock_dq_uninit(&ip->i_iopen_gh);
+       if (unlikely(ret))
                return EVICT_SHOULD_DEFER_DELETE;
-       }
 
        if (gfs2_inode_already_deleted(ip->i_gl, ip->i_no_formal_ino))
                return EVICT_SHOULD_SKIP_DELETE;
@@ -1364,15 +1360,8 @@ static enum evict_behavior evict_should_delete(struct inode *inode,
 
 should_delete:
        if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
-           test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) {
-               enum evict_behavior behavior =
-                       gfs2_upgrade_iopen_glock(inode);
-
-               if (behavior != EVICT_SHOULD_DELETE) {
-                       gfs2_holder_uninit(&ip->i_iopen_gh);
-                       return behavior;
-               }
-       }
+           test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags))
+               return gfs2_upgrade_iopen_glock(inode);
        return EVICT_SHOULD_DELETE;
 }