]> Gentwo Git Trees - linux/.git/commitdiff
gfs2: Replace GIF_DEFER_DELETE with GLF_DEFER_DELETE
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 4 Feb 2025 16:35:13 +0000 (17:35 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 10 Feb 2025 14:51:22 +0000 (15:51 +0100)
Having this flag attached to the iopen glock instead of the inode is
much simpler; it eliminates a protential weird race in gfs2_try_evict().

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

index d6e2ca69663e6b438e51f6ae6ac3ab5ccd88d332..91a4d5c8e9516cbe19f38049886f8549c43edc50 100644 (file)
@@ -991,15 +991,15 @@ static void gfs2_try_evict(struct gfs2_glock *gl)
                }
        }
        if (ip) {
-               set_bit(GIF_DEFER_DELETE, &ip->i_flags);
+               set_bit(GLF_DEFER_DELETE, &gl->gl_flags);
                d_prune_aliases(&ip->i_inode);
                iput(&ip->i_inode);
+               clear_bit(GLF_DEFER_DELETE, &gl->gl_flags);
 
                /* If the inode was evicted, gl->gl_object will now be NULL. */
                spin_lock(&gl->gl_lockref.lock);
                ip = gl->gl_object;
                if (ip) {
-                       clear_bit(GIF_DEFER_DELETE, &ip->i_flags);
                        if (!igrab(&ip->i_inode))
                                ip = NULL;
                }
index a8db1120cefcecd220273923006ce7acb7385af1..40e66b46718b0bc99502c35af2f5617d0cbb2fa6 100644 (file)
@@ -331,6 +331,7 @@ enum {
        GLF_TRY_TO_EVICT                = 17, /* iopen glocks only */
        GLF_VERIFY_DELETE               = 18, /* iopen glocks only */
        GLF_PENDING_REPLY               = 19,
+       GLF_DEFER_DELETE                = 20, /* iopen glocks only */
 };
 
 struct gfs2_glock {
@@ -377,7 +378,6 @@ enum {
        GIF_SW_PAGED            = 3,
        GIF_FREE_VFS_INODE      = 5,
        GIF_GLOP_PENDING        = 6,
-       GIF_DEFER_DELETE        = 7,
 };
 
 struct gfs2_inode {
index 92a3b6ddafdc193979bd667bd4dff2cdd338bb1f..bd2bdcd2879ced1771bab76c48df11d10fd23a5a 100644 (file)
@@ -1329,7 +1329,8 @@ static enum evict_behavior evict_should_delete(struct inode *inode,
        if (unlikely(test_bit(GIF_ALLOC_FAILED, &ip->i_flags)))
                goto should_delete;
 
-       if (test_bit(GIF_DEFER_DELETE, &ip->i_flags))
+       if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
+           test_bit(GLF_DEFER_DELETE, &ip->i_iopen_gh.gh_gl->gl_flags))
                return EVICT_SHOULD_DEFER_DELETE;
 
        /* Deletes should never happen under memory pressure anymore.  */