This patch just simplifies the path through the GL_ST_DEMOTE_NONBLOCK state in the state machine. Regardless of whether a holder is found, it still needs to clear the GLF_LOCK bit. But we need to be careful to do it check for a holder before we release GLF_LOCK.
Signed-off-by: Bob Peterson <rpete...@redhat.com> --- fs/gfs2/glock.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 82c4614793b3..858f42e66698 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -673,15 +673,13 @@ static void __state_machine(struct gfs2_glock *gl, int new_state, case GL_ST_DEMOTE_NONBLOCK: gl->gl_mch = GL_ST_IDLE; - if (find_first_holder(gl)) { - clear_bit(GLF_LOCK, &gl->gl_flags); - smp_mb__after_atomic(); - break; - } + gh = find_first_holder(gl); clear_bit(GLF_LOCK, &gl->gl_flags); smp_mb__after_atomic(); - gl->gl_lockref.count++; - __gfs2_glock_queue_work(gl, 0); + if (!gh) { + gl->gl_lockref.count++; + __gfs2_glock_queue_work(gl, 0); + } break; case GL_ST_PROMOTE: -- 2.19.1