diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2025-07-25 22:06:56 +0200 |
|---|---|---|
| committer | Andreas Gruenbacher <agruenba@redhat.com> | 2025-11-26 23:52:26 +0000 |
| commit | 833c93caea00b0aef3e22a08fd20acacf212b6fc (patch) | |
| tree | 3c176413b729ef9d05f8f72fb7a45c4b89c1f8b0 | |
| parent | 1714e8543dbe21bbd33e62df926552f943f8f5cd (diff) | |
Revert "gfs2: don't stop reads while withdraw in progress"
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>
| -rw-r--r-- | fs/gfs2/incore.h | 1 | ||||
| -rw-r--r-- | fs/gfs2/meta_io.c | 9 | ||||
| -rw-r--r-- | fs/gfs2/sys.c | 2 | ||||
| -rw-r--r-- | fs/gfs2/util.c | 11 | ||||
| -rw-r--r-- | fs/gfs2/util.h | 5 |
5 files changed, 6 insertions, 22 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 5dfdd1f3c5da..7886a4452daf 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h @@ -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 */ diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index c680d5a226bf..e4356198d8d8 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c @@ -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; diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 5439a65549af..80389fc167a6 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c @@ -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), diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 8e47f106e2ba..da7e4e5037b2 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c @@ -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) diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h index d30e6a8ba8af..ffcc47d6b0b4 100644 --- a/fs/gfs2/util.h +++ b/fs/gfs2/util.h @@ -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) |
