]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gfs2: skip if we cannot defer delete
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 6 Mar 2025 21:13:28 +0000 (22:13 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 10 Mar 2025 17:15:38 +0000 (18:15 +0100)
In gfs2_evict_inode(), in the unlikely case that we cannot defer
deleting the inode, it is not safe to fall back to deleting the inode;
the only valid choice we have is to skip the delete.

In addition, in evict_should_delete(), if we cannot lock the inode glock
exclusively, we are in a bad enough state that skipping the delete is
likely a better choice than trying to recover from the failure later.

Fixes: c5b7a2400edc ("gfs2: Only defer deletes when we have an iopen glock")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/super.c

index 28d67131ad79fd0ac5df2fa9f014cf6cdde43be4..44e5658b896c88ae4ccae610a49152fc05a2b06b 100644 (file)
@@ -1340,7 +1340,7 @@ 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))
-               return EVICT_SHOULD_DEFER_DELETE;
+               return EVICT_SHOULD_SKIP_DELETE;
 
        if (gfs2_inode_already_deleted(ip->i_gl, ip->i_no_formal_ino))
                return EVICT_SHOULD_SKIP_DELETE;
@@ -1499,7 +1499,7 @@ static void gfs2_evict_inode(struct inode *inode)
                                gfs2_glock_put(io_gl);
                        goto out;
                }
-               behavior = EVICT_SHOULD_DELETE;
+               behavior = EVICT_SHOULD_SKIP_DELETE;
        }
        if (behavior == EVICT_SHOULD_DELETE)
                ret = evict_unlinked_inode(inode);