summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2025-08-11 21:38:23 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2025-09-12 12:02:53 +0200
commit47faf937da43df9a84e65e5a880cf813e764971e (patch)
tree723102f7ae13db1dfc0c417c3f0c5d366ccc558d
parentcd493dcf4f827700b66d1adb43f20d3838759beb (diff)
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>
-rw-r--r--fs/gfs2/glock.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 1eba27bb5f3c..747ee7ca44e2 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -832,7 +832,12 @@ __acquires(&gl->gl_lockref.lock)
return;
set_bit(GLF_LOCK, &gl->gl_flags);
- /* While a demote is in progress, the GLF_LOCK flag must be set. */
+ /*
+ * The GLF_DEMOTE_IN_PROGRESS flag is only set intermittently during
+ * locking operations. We have just started a locking operation by
+ * setting the GLF_LOCK flag, so the GLF_DEMOTE_IN_PROGRESS flag must
+ * be cleared.
+ */
GLOCK_BUG_ON(gl, test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags));
if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
@@ -859,6 +864,8 @@ promote:
gh = find_first_waiter(gl);
if (!gh)
goto out_unlock;
+ if (nonblock)
+ goto out_sched;
gl->gl_target = gh->gh_state;
if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
do_error(gl, 0); /* Fail queued try locks */