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

Revert "gfs2: Allow some glocks to be used during withdraw"

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 commit a72d2401f54b ("gfs2: Allow some glocks to be used during
withdraw").

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

+6 -46
+5 -32
fs/gfs2/glock.c
··· 137 137 kmem_cache_free(gfs2_glock_cachep, gl); 138 138 } 139 139 140 - /** 141 - * glock_blocked_by_withdraw - determine if we can still use a glock 142 - * @gl: the glock 143 - * 144 - * We need to allow some glocks to be enqueued, dequeued, promoted, and demoted 145 - * when we're withdrawn. For example, to maintain metadata integrity, we should 146 - * disallow the use of inode and rgrp glocks when withdrawn. Other glocks like 147 - * the iopen or freeze glock may be safely used because none of their 148 - * metadata goes through the journal. So in general, we should disallow all 149 - * glocks that are journaled, and allow all the others. One exception is: 150 - * we need to allow our active journal to be promoted and demoted so others 151 - * may recover it and we can reacquire it when they're done. 152 - */ 153 - static bool glock_blocked_by_withdraw(struct gfs2_glock *gl) 154 - { 155 - struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; 156 - 157 - if (!gfs2_withdrawn(sdp)) 158 - return false; 159 - if (gl->gl_ops->go_flags & GLOF_NONDISK) 160 - return false; 161 - if (!sdp->sd_jdesc || 162 - gl->gl_name.ln_number == sdp->sd_jdesc->jd_no_addr) 163 - return false; 164 - return true; 165 - } 166 - 167 140 static void __gfs2_glock_free(struct gfs2_glock *gl) 168 141 { 169 142 rhashtable_remove_fast(&gl_hash_table, &gl->gl_node, ht_parms); ··· 654 681 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 655 682 int ret; 656 683 657 - if (target != LM_ST_UNLOCKED && glock_blocked_by_withdraw(gl)) 684 + if (target != LM_ST_UNLOCKED && gfs2_withdrawn(sdp)) 658 685 goto skip_inval; 659 686 660 687 GLOCK_BUG_ON(gl, gl->gl_state == target); ··· 698 725 spin_lock(&gl->gl_lockref.lock); 699 726 700 727 skip_inval: 701 - if (glock_blocked_by_withdraw(gl) && target != LM_ST_UNLOCKED) { 728 + if (gfs2_withdrawn(sdp) && target != LM_ST_UNLOCKED) { 702 729 request_demote(gl, LM_ST_UNLOCKED, 0, false); 703 730 /* 704 731 * Ordinarily, we would call dlm and its callback would call ··· 1485 1512 int gfs2_glock_nq(struct gfs2_holder *gh) 1486 1513 { 1487 1514 struct gfs2_glock *gl = gh->gh_gl; 1515 + struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; 1488 1516 int error; 1489 1517 1490 - if (glock_blocked_by_withdraw(gl)) 1518 + if (gfs2_withdrawn(sdp)) 1491 1519 return -EIO; 1492 1520 1493 1521 if (gh->gh_flags & GL_NOBLOCK) { ··· 2096 2122 static void withdraw_dq(struct gfs2_glock *gl) 2097 2123 { 2098 2124 spin_lock(&gl->gl_lockref.lock); 2099 - if (!__lockref_is_dead(&gl->gl_lockref) && 2100 - glock_blocked_by_withdraw(gl)) 2125 + if (!__lockref_is_dead(&gl->gl_lockref)) 2101 2126 do_error(gl, LM_OUT_ERROR); /* remove pending waiters */ 2102 2127 spin_unlock(&gl->gl_lockref.lock); 2103 2128 }
+1 -7
fs/gfs2/glops.c
··· 638 638 639 639 const struct gfs2_glock_operations gfs2_meta_glops = { 640 640 .go_type = LM_TYPE_META, 641 - .go_flags = GLOF_NONDISK, 642 641 }; 643 642 644 643 const struct gfs2_glock_operations gfs2_inode_glops = { ··· 663 664 .go_xmote_bh = freeze_go_xmote_bh, 664 665 .go_callback = freeze_go_callback, 665 666 .go_type = LM_TYPE_NONDISK, 666 - .go_flags = GLOF_NONDISK, 667 667 }; 668 668 669 669 const struct gfs2_glock_operations gfs2_iopen_glops = { 670 670 .go_type = LM_TYPE_IOPEN, 671 671 .go_callback = iopen_go_callback, 672 672 .go_dump = inode_go_dump, 673 - .go_flags = GLOF_NONDISK, 674 673 .go_subclass = 1, 675 674 }; 676 675 677 676 const struct gfs2_glock_operations gfs2_flock_glops = { 678 677 .go_type = LM_TYPE_FLOCK, 679 - .go_flags = GLOF_NONDISK, 680 678 }; 681 679 682 680 const struct gfs2_glock_operations gfs2_nondisk_glops = { 683 681 .go_type = LM_TYPE_NONDISK, 684 - .go_flags = GLOF_NONDISK, 685 682 }; 686 683 687 684 const struct gfs2_glock_operations gfs2_quota_glops = { 688 685 .go_type = LM_TYPE_QUOTA, 689 - .go_flags = GLOF_LVB | GLOF_NONDISK, 686 + .go_flags = GLOF_LVB, 690 687 }; 691 688 692 689 const struct gfs2_glock_operations gfs2_journal_glops = { 693 690 .go_type = LM_TYPE_JOURNAL, 694 - .go_flags = GLOF_NONDISK, 695 691 }; 696 692 697 693 const struct gfs2_glock_operations *gfs2_glops_list[] = {
-3
fs/gfs2/incore.h
··· 228 228 const unsigned long go_flags; 229 229 #define GLOF_ASPACE 1 /* address space attached */ 230 230 #define GLOF_LVB 2 /* Lock Value Block attached */ 231 - #define GLOF_NONDISK 8 /* not I/O related */ 232 231 }; 233 232 234 233 enum { ··· 517 518 518 519 struct list_head jd_revoke_list; 519 520 unsigned int jd_replay_tail; 520 - 521 - u64 jd_no_addr; 522 521 }; 523 522 524 523 struct gfs2_statfs_change_host {
-4
fs/gfs2/ops_fstype.c
··· 542 542 mutex_lock(&sdp->sd_jindex_mutex); 543 543 544 544 for (;;) { 545 - struct gfs2_inode *jip; 546 - 547 545 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh); 548 546 if (error) 549 547 break; ··· 582 584 d_mark_dontcache(jd->jd_inode); 583 585 spin_lock(&sdp->sd_jindex_spin); 584 586 jd->jd_jid = sdp->sd_journals++; 585 - jip = GFS2_I(jd->jd_inode); 586 - jd->jd_no_addr = jip->i_no_addr; 587 587 list_add_tail(&jd->jd_list, &sdp->sd_jindex_list); 588 588 spin_unlock(&sdp->sd_jindex_spin); 589 589 }