Skip to content

Commit 47faf93

Browse files
author
Andreas Gruenbacher
committed
gfs2: Minor run_queue fixes
Provide a better description of why the GLF_DEMOTE_IN_PROGRESS flag cannot be set. Function do_xmote() may block, so make sure it isn't called when nonblock is true. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Andrew Price <anprice@redhat.com>
1 parent cd493dc commit 47faf93

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

fs/gfs2/glock.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,12 @@ __acquires(&gl->gl_lockref.lock)
832832
return;
833833
set_bit(GLF_LOCK, &gl->gl_flags);
834834

835-
/* While a demote is in progress, the GLF_LOCK flag must be set. */
835+
/*
836+
* The GLF_DEMOTE_IN_PROGRESS flag is only set intermittently during
837+
* locking operations. We have just started a locking operation by
838+
* setting the GLF_LOCK flag, so the GLF_DEMOTE_IN_PROGRESS flag must
839+
* be cleared.
840+
*/
836841
GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags));
837842

838843
if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
@@ -859,6 +864,8 @@ __acquires(&gl->gl_lockref.lock)
859864
gh = find_first_waiter(gl);
860865
if (!gh)
861866
goto out_unlock;
867+
if (nonblock)
868+
goto out_sched;
862869
gl->gl_target = gh->gh_state;
863870
if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
864871
do_error(gl, 0); /* Fail queued try locks */

0 commit comments

Comments
 (0)