]> Gentwo Git Trees - linux/.git/commitdiff
Revert "gfs2: don't stop reads while withdraw in progress"
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 25 Jul 2025 20:06:56 +0000 (22:06 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 26 Nov 2025 23:52:26 +0000 (23:52 +0000)
The current withdraw code duplicates the journal recovery code gfs2
already has for dealing with node failures, and it does so poorly.  That
code was added because when releasing a lockspace, we didn't have a way
to indicate that the lockspace needs recovery.  We now do have this
feature, so the current withdraw code can be removed almost entirely.
This is one of several steps towards that.

The withdrawing node has no role in recovering from the withdraw
anymore, so it also no longer needs to read metadata blocks after a
withdraw.

We now only need to set a single bit in gfs2_withdraw(), so switch from
try_cmpxchg() to test_and_set_bit().

Reverts commit 8cc67f704f4b ("gfs2: don't stop reads while withdraw in
progress").

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

index 5dfdd1f3c5da6a055d930f29d00ab240bc8b7fa1..7886a4452dafd39fedc5a8dd0251b14ca9d6d656 100644 (file)
@@ -599,7 +599,6 @@ enum {
        SDF_SKIP_DLM_UNLOCK     = 8,
        SDF_FORCE_AIL_FLUSH     = 9,
        SDF_FREEZE_INITIATOR    = 10,
-       SDF_WITHDRAW_IN_PROG    = 12, /* Withdraw is in progress */
        SDF_REMOTE_WITHDRAW     = 13, /* Performing remote recovery */
        SDF_WITHDRAW_RECOVERY   = 14, /* Wait for journal recovery when we are
                                         withdrawing */
index c680d5a226bfc9a6d73a2444935824cafc0f23ae..e4356198d8d83f85d982d9970e8dbb08a4bcc05b 100644 (file)
@@ -263,8 +263,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
        struct buffer_head *bh, *bhs[2];
        int num = 0;
 
-       if (gfs2_withdrawn(sdp) &&
-           !gfs2_withdraw_in_prog(sdp)) {
+       if (gfs2_withdrawn(sdp)) {
                *bhp = NULL;
                return -EIO;
        }
@@ -322,8 +321,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
 
 int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
 {
-       if (gfs2_withdrawn(sdp) &&
-           !gfs2_withdraw_in_prog(sdp))
+       if (gfs2_withdrawn(sdp))
                return -EIO;
 
        wait_on_buffer(bh);
@@ -334,8 +332,7 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
                        gfs2_io_error_bh(sdp, bh);
                return -EIO;
        }
-       if (gfs2_withdrawn(sdp) &&
-           !gfs2_withdraw_in_prog(sdp))
+       if (gfs2_withdrawn(sdp))
                return -EIO;
 
        return 0;
index 5439a65549af7fa6e23287bb86b91c3a8131d7ca..80389fc167a6bdc59aeb0d17f585b55d07328922 100644 (file)
@@ -84,7 +84,6 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
                     "Force AIL Flush:          %d\n"
                     "FS Freeze Initiator:      %d\n"
                     "FS Frozen:                %d\n"
-                    "Withdraw In Prog:         %d\n"
                     "Remote Withdraw:          %d\n"
                     "Withdraw Recovery:        %d\n"
                     "Killing:                  %d\n"
@@ -116,7 +115,6 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
                     test_bit(SDF_FORCE_AIL_FLUSH, &f),
                     test_bit(SDF_FREEZE_INITIATOR, &f),
                     test_bit(SDF_FROZEN, &f),
-                    test_bit(SDF_WITHDRAW_IN_PROG, &f),
                     test_bit(SDF_REMOTE_WITHDRAW, &f),
                     test_bit(SDF_WITHDRAW_RECOVERY, &f),
                     test_bit(SDF_KILL, &f),
index 8e47f106e2baa048ea1565fe2ae276acdacc2d01..da7e4e5037b25477175dc33b96ce8892fc861315 100644 (file)
@@ -330,19 +330,13 @@ void gfs2_withdraw_func(struct work_struct *work)
        if (lm->lm_unmount)
                lm->lm_unmount(sdp, false);
        fs_err(sdp, "file system withdrawn\n");
-       clear_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags);
 }
 
 void gfs2_withdraw(struct gfs2_sbd *sdp)
 {
        if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) {
-               unsigned long old = READ_ONCE(sdp->sd_flags), new;
-
-               do {
-                       if (old & BIT(SDF_WITHDRAWN))
-                               return;
-                       new = old | BIT(SDF_WITHDRAWN) | BIT(SDF_WITHDRAW_IN_PROG);
-               } while (unlikely(!try_cmpxchg(&sdp->sd_flags, &old, new)));
+               if (test_and_set_bit(SDF_WITHDRAWN, &sdp->sd_flags))
+                       return;
 
                dump_stack();
                /*
@@ -353,6 +347,7 @@ void gfs2_withdraw(struct gfs2_sbd *sdp)
                        return;
                fs_err(sdp, "about to withdraw this file system\n");
                schedule_work(&sdp->sd_withdraw_work);
+               return;
        }
 
        if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
index d30e6a8ba8af0ff348682688009fcff9d6d6f501..ffcc47d6b0b4b53dfdb2f89b15ea09df4c5aa9a9 100644 (file)
@@ -187,11 +187,6 @@ static inline bool gfs2_withdrawn(struct gfs2_sbd *sdp)
        return unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags));
 }
 
-static inline bool gfs2_withdraw_in_prog(struct gfs2_sbd *sdp)
-{
-       return unlikely(test_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags));
-}
-
 #define gfs2_tune_get(sdp, field) \
 gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)