From: Jeff Layton <jlayton@kernel.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Joanne Koong <joannelkoong@gmail.com>,
miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
josef@toxicpanda.com, bernd.schubert@fastmail.fm,
jefflexu@linux.alibaba.com, laoar.shao@gmail.com,
tfiga@chromium.org, bgeffon@google.com, etmartin4313@gmail.com,
kernel-team@meta.com
Subject: Re: [PATCH v10 1/2] fuse: add kernel-enforced timeout option for requests
Date: Sun, 15 Dec 2024 07:08:05 -0500 [thread overview]
Message-ID: <b282ea2126d9349ffcbf0682d71684f000fbc091.camel@kernel.org> (raw)
In-Reply-To: <rw7ictyycbqrxuosmr2irzqgtxyfv2pprgvps6tjihbypnxcyc@qqkpoiq65ly3>
On Sun, 2024-12-15 at 17:25 +0900, Sergey Senozhatsky wrote:
> On (24/12/14 07:09), Jeff Layton wrote:
> > > +void fuse_check_timeout(struct work_struct *work)
> > > +{
> > > + struct delayed_work *dwork = to_delayed_work(work);
> > > + struct fuse_conn *fc = container_of(dwork, struct fuse_conn,
> > > + timeout.work);
> > > + struct fuse_iqueue *fiq = &fc->iq;
> > > + struct fuse_req *req;
> > > + struct fuse_dev *fud;
> > > + struct fuse_pqueue *fpq;
> > > + bool expired = false;
> > > + int i;
> > > +
> [..]
> > > +
> > > +fpq_abort:
> > > + spin_unlock(&fpq->lock);
> > > + spin_unlock(&fc->lock);
> > > +abort_conn:
> > > + fuse_abort_conn(fc);
> > > +}
> > > +
> > > @@ -2308,6 +2388,9 @@ void fuse_abort_conn(struct fuse_conn *fc)
> > > spin_unlock(&fc->lock);
> > >
> > > end_requests(&to_end);
> > > +
> > > + if (fc->timeout.req_timeout)
> > > + cancel_delayed_work(&fc->timeout.work);
> >
> > As Sergey pointed out, this should be a cancel_delayed_work_sync().
>
> My worry here is that fuse_abort_conn() can also be called from the
> deferred work handler, I'm not sure if we can cancel_delayed_work_sync()
> from within the same WQ context, sounds deadlock-ish:
>
> WQ -> fuse_check_timeout() -> fuse_abort_conn() -> cancel_delayed_work_sync()
>
> When fuse_abort_conn() is called from somewhere else (umount, etc.) then
> we can safely sync(), but fuse_check_timeout() is different.
>
Very good point.
> Maybe fuse_abort_conn() can become __fuse_abort_conn(), which
> fuse_check_timeout() will call directly, for the rest fuse_abort_conn()
> can be something like:
>
> static void __fuse_abort_conn()
> {
> ....
> }
>
> void fuse_abort_conn()
> {
> cancel_delayed_work_sync()
> __fuse_abort_conn();
> }
That seems like a reasonable solution. It already doesn't requeue the
job when calling fuse_abort_conn(), so that should work.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-12-15 12:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-14 2:28 [PATCH v10 0/2] fuse: add kernel-enforced request timeout option Joanne Koong
2024-12-14 2:28 ` [PATCH v10 1/2] fuse: add kernel-enforced timeout option for requests Joanne Koong
2024-12-14 6:53 ` Sergey Senozhatsky
2024-12-16 18:23 ` Joanne Koong
2024-12-14 12:09 ` Jeff Layton
2024-12-15 8:25 ` Sergey Senozhatsky
2024-12-15 12:08 ` Jeff Layton [this message]
2024-12-16 2:16 ` Etienne Martineau
2024-12-16 4:11 ` Sergey Senozhatsky
2024-12-16 17:32 ` Joanne Koong
2024-12-16 17:51 ` Etienne Martineau
2024-12-16 18:21 ` Joanne Koong
2024-12-16 22:09 ` Etienne Martineau
2024-12-17 1:26 ` Joanne Koong
2024-12-17 20:02 ` Etienne Martineau
2024-12-17 20:37 ` Joanne Koong
2024-12-18 15:32 ` Etienne Martineau
2024-12-18 17:56 ` Joanne Koong
2024-12-18 21:45 ` Joanne Koong
2024-12-16 2:35 ` Etienne Martineau
2024-12-16 18:14 ` Joanne Koong
2024-12-16 21:24 ` Etienne Martineau
2024-12-14 2:28 ` [PATCH v10 2/2] fuse: add default_request_timeout and max_request_timeout sysctls Joanne Koong
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=b282ea2126d9349ffcbf0682d71684f000fbc091.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=bernd.schubert@fastmail.fm \
--cc=bgeffon@google.com \
--cc=etmartin4313@gmail.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 \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.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