Skip to content

Commit fc82ab4

Browse files
AstralBobgregkh
authored andcommitted
gfs2: fix glock confusion in function signal_our_withdraw
commit f5f02fd upstream. If go_free is defined, function signal_our_withdraw is supposed to synchronize on the GLF_FREEING flag of the inode glock, but it accidentally does that on the live glock. Fix that and disambiguate the glock variables. Fixes: 601ef0d ("gfs2: Force withdraw to replay journals and wait for it to finish") Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2e3fb52 commit fc82ab4

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎fs/gfs2/util.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
9393

9494
static void signal_our_withdraw(struct gfs2_sbd *sdp)
9595
{
96-
struct gfs2_glock *gl = sdp->sd_live_gh.gh_gl;
96+
struct gfs2_glock *live_gl = sdp->sd_live_gh.gh_gl;
9797
struct inode *inode = sdp->sd_jdesc->jd_inode;
9898
struct gfs2_inode *ip = GFS2_I(inode);
99+
struct gfs2_glock *i_gl = ip->i_gl;
99100
u64 no_formal_ino = ip->i_no_formal_ino;
100101
int ret = 0;
101102
int tries;
@@ -141,7 +142,8 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
141142
atomic_set(&sdp->sd_freeze_state, SFS_FROZEN);
142143
thaw_super(sdp->sd_vfs);
143144
} else {
144-
wait_on_bit(&gl->gl_flags, GLF_DEMOTE, TASK_UNINTERRUPTIBLE);
145+
wait_on_bit(&i_gl->gl_flags, GLF_DEMOTE,
146+
TASK_UNINTERRUPTIBLE);
145147
}
146148

147149
/*
@@ -161,15 +163,15 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
161163
* on other nodes to be successful, otherwise we remain the owner of
162164
* the glock as far as dlm is concerned.
163165
*/
164-
if (gl->gl_ops->go_free) {
165-
set_bit(GLF_FREEING, &gl->gl_flags);
166-
wait_on_bit(&gl->gl_flags, GLF_FREEING, TASK_UNINTERRUPTIBLE);
166+
if (i_gl->gl_ops->go_free) {
167+
set_bit(GLF_FREEING, &i_gl->gl_flags);
168+
wait_on_bit(&i_gl->gl_flags, GLF_FREEING, TASK_UNINTERRUPTIBLE);
167169
}
168170

169171
/*
170172
* Dequeue the "live" glock, but keep a reference so it's never freed.
171173
*/
172-
gfs2_glock_hold(gl);
174+
gfs2_glock_hold(live_gl);
173175
gfs2_glock_dq_wait(&sdp->sd_live_gh);
174176
/*
175177
* We enqueue the "live" glock in EX so that all other nodes
@@ -208,7 +210,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
208210
gfs2_glock_nq(&sdp->sd_live_gh);
209211
}
210212

211-
gfs2_glock_queue_put(gl); /* drop the extra reference we acquired */
213+
gfs2_glock_queue_put(live_gl); /* drop extra reference we acquired */
212214
clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
213215

214216
/*

0 commit comments

Comments
 (0)