Skip to content

Commit 6bb7c1b

Browse files
author
Andreas Gruenbacher
committed
Revert "gfs2: fix a deadlock on withdraw-during-mount"
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 865cc3e ("gfs2: fix a deadlock on withdraw-during-mount"). Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent dcc42d5 commit 6bb7c1b

1 file changed

Lines changed: 18 additions & 35 deletions

File tree

fs/gfs2/glock.c

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -663,16 +663,6 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
663663
clear_bit(GLF_LOCK, &gl->gl_flags);
664664
}
665665

666-
static bool is_system_glock(struct gfs2_glock *gl)
667-
{
668-
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
669-
struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
670-
671-
if (gl == m_ip->i_gl)
672-
return true;
673-
return false;
674-
}
675-
676666
/**
677667
* do_xmote - Calls the DLM to change the state of a lock
678668
* @gl: The lock state
@@ -747,36 +737,29 @@ __acquires(&gl->gl_lockref.lock)
747737
* to see sd_log_error and withdraw, and in the meantime, requeue the
748738
* work for later.
749739
*
750-
* We make a special exception for some system glocks, such as the
751-
* system statfs inode glock, which needs to be granted before the
752-
* gfs2_quotad daemon can exit, and that exit needs to finish before
753-
* we can unmount the withdrawn file system.
754-
*
755740
* However, if we're just unlocking the lock (say, for unmount, when
756741
* gfs2_gl_hash_clear calls clear_glock) and recovery is complete
757742
* then it's okay to tell dlm to unlock it.
758743
*/
759744
if (glock_blocked_by_withdraw(gl) && target != LM_ST_UNLOCKED) {
760-
if (!is_system_glock(gl)) {
761-
request_demote(gl, LM_ST_UNLOCKED, 0, false);
762-
/*
763-
* Ordinarily, we would call dlm and its callback would call
764-
* finish_xmote, which would call state_change() to the new state.
765-
* Since we withdrew, we won't call dlm, so call state_change
766-
* manually, but to the UNLOCKED state we desire.
767-
*/
768-
state_change(gl, LM_ST_UNLOCKED);
769-
/*
770-
* We skip telling dlm to do the locking, so we won't get a
771-
* reply that would otherwise clear GLF_LOCK. So we clear it here.
772-
*/
773-
if (!test_bit(GLF_CANCELING, &gl->gl_flags))
774-
clear_bit(GLF_LOCK, &gl->gl_flags);
775-
clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
776-
gl->gl_lockref.count++;
777-
gfs2_glock_queue_work(gl, GL_GLOCK_DFT_HOLD);
778-
return;
779-
}
745+
request_demote(gl, LM_ST_UNLOCKED, 0, false);
746+
/*
747+
* Ordinarily, we would call dlm and its callback would call
748+
* finish_xmote, which would call state_change() to the new state.
749+
* Since we withdrew, we won't call dlm, so call state_change
750+
* manually, but to the UNLOCKED state we desire.
751+
*/
752+
state_change(gl, LM_ST_UNLOCKED);
753+
/*
754+
* We skip telling dlm to do the locking, so we won't get a
755+
* reply that would otherwise clear GLF_LOCK. So we clear it here.
756+
*/
757+
if (!test_bit(GLF_CANCELING, &gl->gl_flags))
758+
clear_bit(GLF_LOCK, &gl->gl_flags);
759+
clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
760+
gl->gl_lockref.count++;
761+
gfs2_glock_queue_work(gl, GL_GLOCK_DFT_HOLD);
762+
return;
780763
}
781764

782765
if (ls->ls_ops->lm_lock) {

0 commit comments

Comments
 (0)