Skip to content

Commit af572ef

Browse files
author
Andreas Gruenbacher
committed
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 a72d240 ("gfs2: Allow some glocks to be used during withdraw"). Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 41ad1f7 commit af572ef

4 files changed

Lines changed: 6 additions & 46 deletions

File tree

fs/gfs2/glock.c

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -137,33 +137,6 @@ static void gfs2_glock_dealloc(struct rcu_head *rcu)
137137
kmem_cache_free(gfs2_glock_cachep, gl);
138138
}
139139

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-
167140
static void __gfs2_glock_free(struct gfs2_glock *gl)
168141
{
169142
rhashtable_remove_fast(&gl_hash_table, &gl->gl_node, ht_parms);
@@ -681,7 +654,7 @@ __acquires(&gl->gl_lockref.lock)
681654
struct lm_lockstruct *ls = &sdp->sd_lockstruct;
682655
int ret;
683656

684-
if (target != LM_ST_UNLOCKED && glock_blocked_by_withdraw(gl))
657+
if (target != LM_ST_UNLOCKED && gfs2_withdrawn(sdp))
685658
goto skip_inval;
686659

687660
GLOCK_BUG_ON(gl, gl->gl_state == target);
@@ -725,7 +698,7 @@ __acquires(&gl->gl_lockref.lock)
725698
spin_lock(&gl->gl_lockref.lock);
726699

727700
skip_inval:
728-
if (glock_blocked_by_withdraw(gl) && target != LM_ST_UNLOCKED) {
701+
if (gfs2_withdrawn(sdp) && target != LM_ST_UNLOCKED) {
729702
request_demote(gl, LM_ST_UNLOCKED, 0, false);
730703
/*
731704
* Ordinarily, we would call dlm and its callback would call
@@ -1512,9 +1485,10 @@ static inline void add_to_queue(struct gfs2_holder *gh)
15121485
int gfs2_glock_nq(struct gfs2_holder *gh)
15131486
{
15141487
struct gfs2_glock *gl = gh->gh_gl;
1488+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
15151489
int error;
15161490

1517-
if (glock_blocked_by_withdraw(gl))
1491+
if (gfs2_withdrawn(sdp))
15181492
return -EIO;
15191493

15201494
if (gh->gh_flags & GL_NOBLOCK) {
@@ -2122,8 +2096,7 @@ static void dump_glock_func(struct gfs2_glock *gl)
21222096
static void withdraw_dq(struct gfs2_glock *gl)
21232097
{
21242098
spin_lock(&gl->gl_lockref.lock);
2125-
if (!__lockref_is_dead(&gl->gl_lockref) &&
2126-
glock_blocked_by_withdraw(gl))
2099+
if (!__lockref_is_dead(&gl->gl_lockref))
21272100
do_error(gl, LM_OUT_ERROR); /* remove pending waiters */
21282101
spin_unlock(&gl->gl_lockref.lock);
21292102
}

fs/gfs2/glops.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,6 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote)
638638

639639
const struct gfs2_glock_operations gfs2_meta_glops = {
640640
.go_type = LM_TYPE_META,
641-
.go_flags = GLOF_NONDISK,
642641
};
643642

644643
const struct gfs2_glock_operations gfs2_inode_glops = {
@@ -664,35 +663,30 @@ const struct gfs2_glock_operations gfs2_freeze_glops = {
664663
.go_xmote_bh = freeze_go_xmote_bh,
665664
.go_callback = freeze_go_callback,
666665
.go_type = LM_TYPE_NONDISK,
667-
.go_flags = GLOF_NONDISK,
668666
};
669667

670668
const struct gfs2_glock_operations gfs2_iopen_glops = {
671669
.go_type = LM_TYPE_IOPEN,
672670
.go_callback = iopen_go_callback,
673671
.go_dump = inode_go_dump,
674-
.go_flags = GLOF_NONDISK,
675672
.go_subclass = 1,
676673
};
677674

678675
const struct gfs2_glock_operations gfs2_flock_glops = {
679676
.go_type = LM_TYPE_FLOCK,
680-
.go_flags = GLOF_NONDISK,
681677
};
682678

683679
const struct gfs2_glock_operations gfs2_nondisk_glops = {
684680
.go_type = LM_TYPE_NONDISK,
685-
.go_flags = GLOF_NONDISK,
686681
};
687682

688683
const struct gfs2_glock_operations gfs2_quota_glops = {
689684
.go_type = LM_TYPE_QUOTA,
690-
.go_flags = GLOF_LVB | GLOF_NONDISK,
685+
.go_flags = GLOF_LVB,
691686
};
692687

693688
const struct gfs2_glock_operations gfs2_journal_glops = {
694689
.go_type = LM_TYPE_JOURNAL,
695-
.go_flags = GLOF_NONDISK,
696690
};
697691

698692
const struct gfs2_glock_operations *gfs2_glops_list[] = {

fs/gfs2/incore.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ struct gfs2_glock_operations {
228228
const unsigned long go_flags;
229229
#define GLOF_ASPACE 1 /* address space attached */
230230
#define GLOF_LVB 2 /* Lock Value Block attached */
231-
#define GLOF_NONDISK 8 /* not I/O related */
232231
};
233232

234233
enum {
@@ -518,8 +517,6 @@ struct gfs2_jdesc {
518517

519518
struct list_head jd_revoke_list;
520519
unsigned int jd_replay_tail;
521-
522-
u64 jd_no_addr;
523520
};
524521

525522
struct gfs2_statfs_change_host {

fs/gfs2/ops_fstype.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,6 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
542542
mutex_lock(&sdp->sd_jindex_mutex);
543543

544544
for (;;) {
545-
struct gfs2_inode *jip;
546-
547545
error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh);
548546
if (error)
549547
break;
@@ -584,8 +582,6 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
584582
d_mark_dontcache(jd->jd_inode);
585583
spin_lock(&sdp->sd_jindex_spin);
586584
jd->jd_jid = sdp->sd_journals++;
587-
jip = GFS2_I(jd->jd_inode);
588-
jd->jd_no_addr = jip->i_no_addr;
589585
list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
590586
spin_unlock(&sdp->sd_jindex_spin);
591587
}

0 commit comments

Comments
 (0)