Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "gfs2: Force withdraw to replay journals and wait for it to finish" (3/6)

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.

Reverts parts of commit 601ef0d52e96 ("gfs2: Force withdraw to replay
journals and wait for it to finish").

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

-86
-52
fs/gfs2/glops.c
··· 30 30 31 31 struct workqueue_struct *gfs2_freeze_wq; 32 32 33 - extern struct workqueue_struct *gfs2_control_wq; 34 - 35 33 static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) 36 34 { 37 35 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; ··· 636 638 } 637 639 } 638 640 639 - /** 640 - * nondisk_go_callback - used to signal when a node did a withdraw 641 - * @gl: the nondisk glock 642 - * @remote: true if this came from a different cluster node 643 - * 644 - */ 645 - static void nondisk_go_callback(struct gfs2_glock *gl, bool remote) 646 - { 647 - struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; 648 - 649 - /* Ignore the callback unless it's from another node, and it's the 650 - live lock. */ 651 - if (!remote || gl->gl_name.ln_number != GFS2_LIVE_LOCK) 652 - return; 653 - 654 - /* First order of business is to cancel the demote request. We don't 655 - * really want to demote a nondisk glock. At best it's just to inform 656 - * us of another node's withdraw. We'll keep it in SH mode. */ 657 - clear_bit(GLF_DEMOTE, &gl->gl_flags); 658 - clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags); 659 - 660 - /* Ignore the unlock if we're withdrawn, unmounting, or in recovery. */ 661 - if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || 662 - test_bit(SDF_WITHDRAWN, &sdp->sd_flags) || 663 - test_bit(SDF_REMOTE_WITHDRAW, &sdp->sd_flags)) 664 - return; 665 - 666 - /* We only care when a node wants us to unlock, because that means 667 - * they want a journal recovered. */ 668 - if (gl->gl_demote_state != LM_ST_UNLOCKED) 669 - return; 670 - 671 - if (sdp->sd_args.ar_spectator) { 672 - fs_warn(sdp, "Spectator node cannot recover journals.\n"); 673 - return; 674 - } 675 - 676 - fs_warn(sdp, "Some node has withdrawn; checking for recovery.\n"); 677 - set_bit(SDF_REMOTE_WITHDRAW, &sdp->sd_flags); 678 - /* 679 - * We can't call remote_withdraw directly here or gfs2_recover_journal 680 - * because this is called from the glock unlock function and the 681 - * remote_withdraw needs to enqueue and dequeue the same "live" glock 682 - * we were called from. So we queue it to the control work queue in 683 - * lock_dlm. 684 - */ 685 - queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, 0); 686 - } 687 - 688 641 const struct gfs2_glock_operations gfs2_meta_glops = { 689 642 .go_type = LM_TYPE_META, 690 643 .go_flags = GLOF_NONDISK, ··· 683 734 const struct gfs2_glock_operations gfs2_nondisk_glops = { 684 735 .go_type = LM_TYPE_NONDISK, 685 736 .go_flags = GLOF_NONDISK, 686 - .go_callback = nondisk_go_callback, 687 737 }; 688 738 689 739 const struct gfs2_glock_operations gfs2_quota_glops = {
-1
fs/gfs2/incore.h
··· 597 597 SDF_SKIP_DLM_UNLOCK = 8, 598 598 SDF_FORCE_AIL_FLUSH = 9, 599 599 SDF_FREEZE_INITIATOR = 10, 600 - SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */ 601 600 SDF_KILL = 15, 602 601 SDF_EVICTING = 16, 603 602 SDF_FROZEN = 17,
-31
fs/gfs2/lock_dlm.c
··· 15 15 #include <linux/sched/signal.h> 16 16 17 17 #include "incore.h" 18 - #include "recovery.h" 19 18 #include "util.h" 20 19 #include "sys.h" 21 20 #include "trace_gfs2.h" ··· 394 395 /* 395 396 * dlm/gfs2 recovery coordination using dlm_recover callbacks 396 397 * 397 - * 0. gfs2 checks for another cluster node withdraw, needing journal replay 398 398 * 1. dlm_controld sees lockspace members change 399 399 * 2. dlm_controld blocks dlm-kernel locking activity 400 400 * 3. dlm_controld within dlm-kernel notifies gfs2 (recover_prep) ··· 651 653 &ls->ls_control_lksb, "control_lock"); 652 654 } 653 655 654 - /** 655 - * remote_withdraw - react to a node withdrawing from the file system 656 - * @sdp: The superblock 657 - */ 658 - static void remote_withdraw(struct gfs2_sbd *sdp) 659 - { 660 - struct gfs2_jdesc *jd; 661 - int ret = 0, count = 0; 662 - 663 - list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { 664 - if (jd->jd_jid == sdp->sd_lockstruct.ls_jid) 665 - continue; 666 - ret = gfs2_recover_journal(jd, true); 667 - if (ret) 668 - break; 669 - count++; 670 - } 671 - 672 - /* Now drop the additional reference we acquired */ 673 - fs_err(sdp, "Journals checked: %d, ret = %d.\n", count, ret); 674 - } 675 - 676 656 static void gfs2_control_func(struct work_struct *work) 677 657 { 678 658 struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work); ··· 660 684 int write_lvb = 0; 661 685 int recover_size; 662 686 int i, error; 663 - 664 - /* First check for other nodes that may have done a withdraw. */ 665 - if (test_bit(SDF_REMOTE_WITHDRAW, &sdp->sd_flags)) { 666 - remote_withdraw(sdp); 667 - clear_bit(SDF_REMOTE_WITHDRAW, &sdp->sd_flags); 668 - return; 669 - } 670 687 671 688 spin_lock(&ls->ls_recover_spin); 672 689 /*
-2
fs/gfs2/sys.c
··· 84 84 "Force AIL Flush: %d\n" 85 85 "FS Freeze Initiator: %d\n" 86 86 "FS Frozen: %d\n" 87 - "Remote Withdraw: %d\n" 88 87 "Killing: %d\n" 89 88 "sd_log_error: %d\n" 90 89 "sd_log_flush_lock: %d\n" ··· 113 114 test_bit(SDF_FORCE_AIL_FLUSH, &f), 114 115 test_bit(SDF_FREEZE_INITIATOR, &f), 115 116 test_bit(SDF_FROZEN, &f), 116 - test_bit(SDF_REMOTE_WITHDRAW, &f), 117 117 test_bit(SDF_KILL, &f), 118 118 sdp->sd_log_error, 119 119 rwsem_is_locked(&sdp->sd_log_flush_lock),