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" (1/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>

+1 -36
+1 -22
fs/gfs2/glock.c
··· 757 757 * gfs2_gl_hash_clear calls clear_glock) and recovery is complete 758 758 * then it's okay to tell dlm to unlock it. 759 759 */ 760 - if (glock_blocked_by_withdraw(gl) && 761 - (target != LM_ST_UNLOCKED || 762 - test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) { 760 + if (glock_blocked_by_withdraw(gl) && target != LM_ST_UNLOCKED) { 763 761 if (!is_system_glock(gl)) { 764 762 request_demote(gl, LM_ST_UNLOCKED, 0, false); 765 763 /* ··· 1646 1648 void gfs2_glock_dq(struct gfs2_holder *gh) 1647 1649 { 1648 1650 struct gfs2_glock *gl = gh->gh_gl; 1649 - struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; 1650 1651 1651 1652 spin_lock(&gl->gl_lockref.lock); 1652 1653 if (!gfs2_holder_queued(gh)) { ··· 1670 1673 clear_bit(GLF_LOCK, &gl->gl_flags); 1671 1674 if (!gfs2_holder_queued(gh)) 1672 1675 goto out; 1673 - } 1674 - 1675 - /* 1676 - * If we're in the process of file system withdraw, we cannot just 1677 - * dequeue any glocks until our journal is recovered, lest we introduce 1678 - * file system corruption. We need two exceptions to this rule: We need 1679 - * to allow unlocking of nondisk glocks and the glock for our own 1680 - * journal that needs recovery. 1681 - */ 1682 - if (test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags) && 1683 - glock_blocked_by_withdraw(gl) && 1684 - gh->gh_gl != sdp->sd_jinode_gl) { 1685 - sdp->sd_glock_dqs_held++; 1686 - spin_unlock(&gl->gl_lockref.lock); 1687 - might_sleep(); 1688 - wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY, 1689 - TASK_UNINTERRUPTIBLE); 1690 - spin_lock(&gl->gl_lockref.lock); 1691 1676 } 1692 1677 1693 1678 __gfs2_glock_dq(gh);
-4
fs/gfs2/incore.h
··· 600 600 SDF_FORCE_AIL_FLUSH = 9, 601 601 SDF_FREEZE_INITIATOR = 10, 602 602 SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */ 603 - SDF_WITHDRAW_RECOVERY = 14, /* Wait for journal recovery when we are 604 - withdrawing */ 605 603 SDF_KILL = 15, 606 604 SDF_EVICTING = 16, 607 605 SDF_FROZEN = 17, ··· 758 760 struct gfs2_jdesc *sd_jdesc; 759 761 struct gfs2_holder sd_journal_gh; 760 762 struct gfs2_holder sd_jinode_gh; 761 - struct gfs2_glock *sd_jinode_gl; 762 763 763 764 struct gfs2_holder sd_sc_gh; 764 765 struct buffer_head *sd_sc_bh; ··· 842 845 843 846 unsigned long sd_last_warning; 844 847 struct dentry *debugfs_dir; /* debugfs directory */ 845 - unsigned long sd_glock_dqs_held; 846 848 }; 847 849 848 850 #define GFS2_BAD_INO 1
-1
fs/gfs2/ops_fstype.c
··· 754 754 } 755 755 756 756 ip = GFS2_I(sdp->sd_jdesc->jd_inode); 757 - sdp->sd_jinode_gl = ip->i_gl; 758 757 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 759 758 LM_FLAG_RECOVER | GL_EXACT | 760 759 GL_NOCACHE | GL_NOPID,
-2
fs/gfs2/sys.c
··· 85 85 "FS Freeze Initiator: %d\n" 86 86 "FS Frozen: %d\n" 87 87 "Remote Withdraw: %d\n" 88 - "Withdraw Recovery: %d\n" 89 88 "Killing: %d\n" 90 89 "sd_log_error: %d\n" 91 90 "sd_log_flush_lock: %d\n" ··· 115 116 test_bit(SDF_FREEZE_INITIATOR, &f), 116 117 test_bit(SDF_FROZEN, &f), 117 118 test_bit(SDF_REMOTE_WITHDRAW, &f), 118 - test_bit(SDF_WITHDRAW_RECOVERY, &f), 119 119 test_bit(SDF_KILL, &f), 120 120 sdp->sd_log_error, 121 121 rwsem_is_locked(&sdp->sd_log_flush_lock),
-7
fs/gfs2/util.c
··· 134 134 i_gl = ip->i_gl; 135 135 no_formal_ino = ip->i_no_formal_ino; 136 136 137 - /* Prevent any glock dq until withdraw recovery is complete */ 138 - set_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags); 139 137 /* 140 138 * Don't tell dlm we're bailing until we have no more buffers in the 141 139 * wind. If journal had an IO error, the log code should just purge ··· 171 173 if (sdp->sd_lockstruct.ls_ops->lm_lock == NULL) { /* lock_nolock */ 172 174 if (!ret) 173 175 ret = -EIO; 174 - clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags); 175 176 goto skip_recovery; 176 177 } 177 178 /* ··· 230 233 ret = gfs2_glock_nq(&sdp->sd_live_gh); 231 234 232 235 gfs2_glock_put(live_gl); /* drop extra reference we acquired */ 233 - clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags); 234 236 235 237 /* 236 238 * If we actually got the "live" lock in EX mode, there are no other ··· 284 288 else 285 289 fs_warn(sdp, "Journal recovery skipped for jid %d until next " 286 290 "mount.\n", sdp->sd_lockstruct.ls_jid); 287 - fs_warn(sdp, "Glock dequeues delayed: %lu\n", sdp->sd_glock_dqs_held); 288 - sdp->sd_glock_dqs_held = 0; 289 - wake_up_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY); 290 291 } 291 292 292 293 void gfs2_lm(struct gfs2_sbd *sdp, const char *fmt, ...)