Skip to content

Commit 5bb6a38

Browse files
author
Andreas Gruenbacher
committed
gfs2: Minor run_queue fixes
JIRA: https://issues.redhat.com/browse/RHEL-116886 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git 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> (cherry picked from commit 47faf93)
1 parent 9f7e6b4 commit 5bb6a38

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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
if (test_and_set_bit(GLF_LOCK, &gl->gl_flags))
833833
return;
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)