]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gfs2: Get rid of GLF_INVALIDATE_IN_PROGRESS
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 8 Aug 2025 21:26:12 +0000 (23:26 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 12 Sep 2025 10:02:41 +0000 (12:02 +0200)
Get rid of the GLF_INVALIDATE_IN_PROGRESS flag: it was originally used
to indicate to add_to_queue() that the ->go_sync() and ->go_invalid()
operations were in progress, but as we have established in commit "gfs2:
Fix LM_FLAG_TRY* logic in add_to_queue", add_to_queue() has no need to
know.

Commit d99724c3c36a describes a race in which GLF_INVALIDATE_IN_PROGRESS
is used to serialize two processes which are both in do_xmote() at the
same time.  That analysis is wrong: the serialization happens via the
GLF_LOCK flag, which ensures that at most one glock operation can be
active at any time.

Fixes: d99724c3c36a ("gfs2: Close timing window with GLF_INVALIDATE_IN_PROGRESS")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Andrew Price <anprice@redhat.com>
fs/gfs2/glock.c
fs/gfs2/incore.h
fs/gfs2/trace_gfs2.h

index 5361a2641cdbd7c141519e1e54575cab95c01405..e8b630a58da8f89bcce5a4f3e7834d8d8eab5b20 100644 (file)
@@ -703,17 +703,6 @@ __acquires(&gl->gl_lockref.lock)
 
        GLOCK_BUG_ON(gl, gl->gl_state == target);
        GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);
-       if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) &&
-           glops->go_inval) {
-               /*
-                * If another process is already doing the invalidate, let that
-                * finish first.  The glock state machine will get back to this
-                * holder again later.
-                */
-               if (test_and_set_bit(GLF_INVALIDATE_IN_PROGRESS,
-                                    &gl->gl_flags))
-                       return;
-       }
        if (!glops->go_inval || !glops->go_sync)
                goto skip_inval;
 
@@ -732,7 +721,7 @@ __acquires(&gl->gl_lockref.lock)
                goto skip_inval;
        }
 
-       if (test_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags)) {
+       if (target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) {
                /*
                 * The call to go_sync should have cleared out the ail list.
                 * If there are still items, we have a problem. We ought to
@@ -747,7 +736,6 @@ __acquires(&gl->gl_lockref.lock)
                        gfs2_dump_glock(NULL, gl, true);
                }
                glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA);
-               clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags);
        }
        spin_lock(&gl->gl_lockref.lock);
 
@@ -2316,8 +2304,6 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
                *p++ = 'y';
        if (test_bit(GLF_LFLUSH, gflags))
                *p++ = 'f';
-       if (test_bit(GLF_INVALIDATE_IN_PROGRESS, gflags))
-               *p++ = 'i';
        if (test_bit(GLF_PENDING_REPLY, gflags))
                *p++ = 'R';
        if (test_bit(GLF_HAVE_REPLY, gflags))
index 78a00239e384fba85df3215a9451317cdb340309..cd8a3f469291ffcff612da84b105e1ba48496efa 100644 (file)
@@ -319,7 +319,6 @@ enum {
        GLF_DEMOTE_IN_PROGRESS          = 5,
        GLF_DIRTY                       = 6,
        GLF_LFLUSH                      = 7,
-       GLF_INVALIDATE_IN_PROGRESS      = 8,
        GLF_HAVE_REPLY                  = 9,
        GLF_INITIAL                     = 10,
        GLF_HAVE_FROZEN_REPLY           = 11,
index 26036ffc3f338e7a46a3c5c97b90d5fcb13ce863..1c2507a273180bc2035eb839a5a6da2b53008b65 100644 (file)
@@ -52,7 +52,6 @@
        {(1UL << GLF_DEMOTE_IN_PROGRESS),       "p" },          \
        {(1UL << GLF_DIRTY),                    "y" },          \
        {(1UL << GLF_LFLUSH),                   "f" },          \
-       {(1UL << GLF_INVALIDATE_IN_PROGRESS),   "i" },          \
        {(1UL << GLF_PENDING_REPLY),            "R" },          \
        {(1UL << GLF_HAVE_REPLY),               "r" },          \
        {(1UL << GLF_INITIAL),                  "a" },          \