Skip to content

Commit 833c93c

Browse files
author
Andreas Gruenbacher
committed
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 8cc67f7 ("gfs2: don't stop reads while withdraw in progress"). Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 1714e85 commit 833c93c

5 files changed

Lines changed: 6 additions & 22 deletions

File tree

fs/gfs2/incore.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ enum {
599599
SDF_SKIP_DLM_UNLOCK = 8,
600600
SDF_FORCE_AIL_FLUSH = 9,
601601
SDF_FREEZE_INITIATOR = 10,
602-
SDF_WITHDRAW_IN_PROG = 12, /* Withdraw is in progress */
603602
SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */
604603
SDF_WITHDRAW_RECOVERY = 14, /* Wait for journal recovery when we are
605604
withdrawing */

fs/gfs2/meta_io.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
263263
struct buffer_head *bh, *bhs[2];
264264
int num = 0;
265265

266-
if (gfs2_withdrawn(sdp) &&
267-
!gfs2_withdraw_in_prog(sdp)) {
266+
if (gfs2_withdrawn(sdp)) {
268267
*bhp = NULL;
269268
return -EIO;
270269
}
@@ -322,8 +321,7 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
322321

323322
int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
324323
{
325-
if (gfs2_withdrawn(sdp) &&
326-
!gfs2_withdraw_in_prog(sdp))
324+
if (gfs2_withdrawn(sdp))
327325
return -EIO;
328326

329327
wait_on_buffer(bh);
@@ -334,8 +332,7 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
334332
gfs2_io_error_bh(sdp, bh);
335333
return -EIO;
336334
}
337-
if (gfs2_withdrawn(sdp) &&
338-
!gfs2_withdraw_in_prog(sdp))
335+
if (gfs2_withdrawn(sdp))
339336
return -EIO;
340337

341338
return 0;

fs/gfs2/sys.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
8484
"Force AIL Flush: %d\n"
8585
"FS Freeze Initiator: %d\n"
8686
"FS Frozen: %d\n"
87-
"Withdraw In Prog: %d\n"
8887
"Remote Withdraw: %d\n"
8988
"Withdraw Recovery: %d\n"
9089
"Killing: %d\n"
@@ -116,7 +115,6 @@ static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
116115
test_bit(SDF_FORCE_AIL_FLUSH, &f),
117116
test_bit(SDF_FREEZE_INITIATOR, &f),
118117
test_bit(SDF_FROZEN, &f),
119-
test_bit(SDF_WITHDRAW_IN_PROG, &f),
120118
test_bit(SDF_REMOTE_WITHDRAW, &f),
121119
test_bit(SDF_WITHDRAW_RECOVERY, &f),
122120
test_bit(SDF_KILL, &f),

fs/gfs2/util.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,19 +330,13 @@ void gfs2_withdraw_func(struct work_struct *work)
330330
if (lm->lm_unmount)
331331
lm->lm_unmount(sdp, false);
332332
fs_err(sdp, "file system withdrawn\n");
333-
clear_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags);
334333
}
335334

336335
void gfs2_withdraw(struct gfs2_sbd *sdp)
337336
{
338337
if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) {
339-
unsigned long old = READ_ONCE(sdp->sd_flags), new;
340-
341-
do {
342-
if (old & BIT(SDF_WITHDRAWN))
343-
return;
344-
new = old | BIT(SDF_WITHDRAWN) | BIT(SDF_WITHDRAW_IN_PROG);
345-
} while (unlikely(!try_cmpxchg(&sdp->sd_flags, &old, new)));
338+
if (test_and_set_bit(SDF_WITHDRAWN, &sdp->sd_flags))
339+
return;
346340

347341
dump_stack();
348342
/*
@@ -353,6 +347,7 @@ void gfs2_withdraw(struct gfs2_sbd *sdp)
353347
return;
354348
fs_err(sdp, "about to withdraw this file system\n");
355349
schedule_work(&sdp->sd_withdraw_work);
350+
return;
356351
}
357352

358353
if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)

fs/gfs2/util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@ static inline bool gfs2_withdrawn(struct gfs2_sbd *sdp)
187187
return unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags));
188188
}
189189

190-
static inline bool gfs2_withdraw_in_prog(struct gfs2_sbd *sdp)
191-
{
192-
return unlikely(test_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags));
193-
}
194-
195190
#define gfs2_tune_get(sdp, field) \
196191
gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)
197192

0 commit comments

Comments
 (0)