From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
josef@toxicpanda.com, bernd.schubert@fastmail.fm,
jefflexu@linux.alibaba.com, laoar.shao@gmail.com,
kernel-team@meta.com, Bernd Schubert <bschubert@ddn.com>
Subject: Re: [PATCH RESEND v9 2/3] fuse: add optional kernel-enforced timeout for requests
Date: Thu, 28 Nov 2024 19:44:37 +0900 [thread overview]
Message-ID: <20241128104437.GB10431@google.com> (raw)
In-Reply-To: <20241114191332.669127-3-joannelkoong@gmail.com>
Hi Joanne,
On (24/11/14 11:13), Joanne Koong wrote:
> There are situations where fuse servers can become unresponsive or
> stuck, for example if the server is deadlocked. Currently, there's no
> good way to detect if a server is stuck and needs to be killed manually.
>
> This commit adds an option for enforcing a timeout (in minutes) for
> requests where if the timeout elapses without the server responding to
> the request, the connection will be automatically aborted.
Does it make sense to configure timeout in seconds? hung-task watchdog
operates in seconds and can be set to anything, e.g. 45 seconds, so it
panic the system before fuse timeout has a chance to trigger.
Another question is: this will terminate the connection. Does it
make sense to run timeout per request and just "abort" individual
requests? What I'm currently playing with here on our side is
something like this:
----
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 8573d79ef29c..82e071cecafd 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -21,6 +21,7 @@
#include <linux/swap.h>
#include <linux/splice.h>
#include <linux/sched.h>
+#include <linux/sched/sysctl.h>
MODULE_ALIAS_MISCDEV(FUSE_MINOR);
MODULE_ALIAS("devname:fuse");
@@ -368,11 +369,24 @@ static void request_wait_answer(struct fuse_req *req)
int err;
if (!fc->no_interrupt) {
- /* Any signal may interrupt this */
- err = wait_event_interruptible(req->waitq,
+ /* We can use CONFIG_DEFAULT_HUNG_TASK_TIMEOUT here */
+ unsigned long hang_check = sysctl_hung_task_timeout_secs;
+
+ if (hang_check) {
+ /* Any signal or timeout may interrupt this */
+ err = wait_event_interruptible_timeout(req->waitq,
+ test_bit(FR_FINISHED, &req->flags),
+ hang_check * (HZ / 2));
+ if (err > 0)
+ return;
+ } else {
+ /* Any signal may interrupt this */
+ err = wait_event_interruptible(req->waitq,
test_bit(FR_FINISHED, &req->flags));
- if (!err)
- return;
+
+ if (!err)
+ return;
+ }
set_bit(FR_INTERRUPTED, &req->flags);
/* matches barrier in fuse_dev_do_read() */
next prev parent reply other threads:[~2024-11-28 10:44 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 19:13 [PATCH RESEND v9 0/3] fuse: add kernel-enforced request timeout option Joanne Koong
2024-11-14 19:13 ` [PATCH RESEND v9 1/3] fs_parser: add fsparam_u16 helper Joanne Koong
2024-11-14 19:13 ` [PATCH RESEND v9 2/3] fuse: add optional kernel-enforced timeout for requests Joanne Koong
2024-11-28 10:44 ` Sergey Senozhatsky [this message]
2024-11-28 11:00 ` Bernd Schubert
2024-11-28 11:09 ` Sergey Senozhatsky
2024-11-28 11:23 ` Bernd Schubert
2024-11-28 11:54 ` Sergey Senozhatsky
2024-12-02 9:45 ` Tomasz Figa
2024-12-02 14:43 ` Bernd Schubert
2024-12-02 19:29 ` Joanne Koong
2024-12-03 4:31 ` Sergey Senozhatsky
2024-12-03 5:11 ` Joanne Koong
2024-12-04 14:40 ` Tomasz Figa
2024-12-04 14:51 ` Brian Geffon
2024-12-04 15:09 ` Bernd Schubert
2024-12-05 3:23 ` Sergey Senozhatsky
2024-12-05 11:07 ` Brian Geffon
2024-12-03 11:01 ` Sergey Senozhatsky
2024-12-06 0:06 ` Joanne Koong
2024-12-06 4:28 ` Sergey Senozhatsky
2024-12-04 13:14 ` Sergey Senozhatsky
2024-12-05 23:10 ` Joanne Koong
2024-12-04 13:47 ` Sergey Senozhatsky
2024-12-05 23:29 ` Joanne Koong
2024-12-06 3:26 ` Sergey Senozhatsky
2024-12-06 0:37 ` Jeff Layton
2024-12-06 19:19 ` Joanne Koong
2024-12-06 20:06 ` Jeff Layton
2024-12-06 16:30 ` Etienne Martineau
2024-12-06 19:05 ` Joanne Koong
2024-12-06 19:56 ` Etienne
2024-12-06 21:52 ` Joanne Koong
2024-12-06 20:12 ` Jeff Layton
2024-12-06 21:54 ` Joanne Koong
2024-11-14 19:13 ` [PATCH RESEND v9 3/3] fuse: add default_request_timeout and max_request_timeout sysctls Joanne Koong
2024-12-06 0:43 ` Jeff Layton
2024-12-06 18:16 ` Joanne Koong
2024-11-21 22:02 ` [PATCH RESEND v9 0/3] fuse: add kernel-enforced request timeout option Josef Bacik
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=20241128104437.GB10431@google.com \
--to=senozhatsky@chromium.org \
--cc=bernd.schubert@fastmail.fm \
--cc=bschubert@ddn.com \
--cc=jefflexu@linux.alibaba.com \
--cc=joannelkoong@gmail.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@meta.com \
--cc=laoar.shao@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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