From: Hengyu Liang <hengyul@cs.unc.edu>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] gfs2: restart rename when a signal interrupts the glock wait
Date: Wed, 25 Nov 2026 22:28:26 -0500 [thread overview]
Message-ID: <20261126032826.4156477-1-hengyul@cs.unc.edu> (raw)
In-Reply-To: <20261125185332.2549812-1-agruenba@redhat.com>
Hi Andreas,
On Wed, 25 Nov 2026 at 19:53, Andreas Gruenbacher <agruenba@redhat.com> wrote:
> Why not make gfs2_glock_async_wait() non-interruptible instead?
> Something like the below should work.
That is better, thanks.
There is one problem in the sketch:
> prepare_to_wait(waitq[i], wait + i, TASK_INTERRUPTIBLE);
> if (!glocks_pending(num_gh, ghs))
> break;
> - if (signal_pending(current)) {
> + ret = schedule_timeout_killable(ret);
schedule_timeout_killable() sets the task state to TASK_KILLABLE again
after glocks_pending() has been checked. If the last pending glock is
granted between the check and that point, the wakeup sets the task to
TASK_RUNNING and removes the wait entry, and then the state is
overwritten. The task then sleeps until the timeout expires. It does
not hang, but the rename waits for the rest of the timeout.
I would pass TASK_KILLABLE to prepare_to_wait() and keep
schedule_timeout():
for (;;) {
for (i = 0; i < num_gh; i++)
prepare_to_wait(waitq[i], wait + i, TASK_KILLABLE);
if (!glocks_pending(num_gh, ghs))
break;
if (fatal_signal_pending(current)) {
ret = -EINTR;
break;
}
ret = schedule_timeout(ret);
if (!glocks_pending(num_gh, ghs))
break;
if (!ret) {
ret = -ESTALE; /* request timed out. */
break;
}
}
The back-off sleep would be schedule_timeout_killable() followed by
fatal_signal_pending(), as in your sketch.
I tested this version on gfs2 for-next with lock_nolock, KASAN and
lockdep. The mv reproducer from the patch moves all 12000 files, and no
rename fails with EINTR under SA_RESTART handlers, handlers without
SA_RESTART, or stop / continue. SIGKILL and SIGTERM still end a rename,
and fsck.gfs2 is clean afterwards.
If that is fine with you, I will send a v2 like this with your
Suggested-by.
Thanks,
Hengyu
prev parent reply other threads:[~2026-11-26 3:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 17:50 Hengyu Liang
2026-11-25 18:53 ` Andreas Gruenbacher
2026-11-26 3:28 ` Hengyu Liang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126032826.4156477-1-hengyul@cs.unc.edu \
--to=hengyul@cs.unc.edu \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®