public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Horst Birthelmer <horst@birthelmer.de>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: Bernd Schubert <bernd@bsbernd.com>,
	Bernd Schubert <bschubert@ddn.com>,
	 Miklos Szeredi <miklos@szeredi.hu>,
	linux-fsdevel@vger.kernel.org, Jian Huang Li <ali@ddn.com>,
	 stable@vger.kernel.org, Horst Birthelmer <hbirthelmer@ddn.com>
Subject: Re: Re: Re: Re: [PATCH 0/2] fuse: Fix possible memleak at startup with immediate teardown
Date: Fri, 10 Apr 2026 23:49:10 +0200	[thread overview]
Message-ID: <adlpMVjXfOKyIUPr@fedora> (raw)
In-Reply-To: <CAJnrk1acOQ4vm0bj+uLsx7vRodcwJBbfxjY=mn0BJ_j_eMr11Q@mail.gmail.com>

On Fri, Apr 10, 2026 at 01:09:36PM -0700, Joanne Koong wrote:
> 
> Gotcha, thanks for clarifying.
> 
> Without the original patch, can queue_refs still be 0 by the time
> fuse_abort_conn() is called? The only case where I see that is when
> the sqes are in the middle of being registered but haven't grabbed the
> queue ref yet, and then the abort logic runs (I am going to write more
> about this race in a reply to Bernd's other message in this thread),
> but other than that I don't see how without the original patch we run
> into this case since teardown -> queue ref decrement only happens in
> fuse_uring_stop_list_entries() which only is triggered on the abort
> path. Are you talking about a subsequent fuse_abort_conn() call (the
> one called from fuse_dev_release())?
> 

To your first question if this can happen without the patch.
I have not seen it but the async teardown of the entry could run before
fuse_abort_conn() could it not?

With the patch the stack usually looks something like

Daemon Process Exit
  └─> io_uring_task_cancel()
      └─> io_uring_cancel_generic(true, NULL)
          └─> io_uring_try_cancel_requests(ctx, current, true)
              └─> io_uring_try_cancel_uring_cmd(ctx, task, true) 
                  └─> file->f_op->uring_cmd(cmd, IO_URING_F_CANCEL) 
                      └─> fuse_uring_cmd(cmd, IO_URING_F_CANCEL) 
                          └─> fuse_uring_cancel(cmd, issue_flags)
                              └─> fuse_uring_entry_teardown(ent, issue_flags) 

And this runs before fuse_abort_conn().

Without the patch fuse_uring_cancel() does not call fuse_uring_entry_teardown() directly.
You are completely right in the current version there is no other call to 
fuse_uring_stop_queues() than the one in Fuse_uring_abort().

So yes, without the modification there is no way queue_refs == 0 by the time
fuse_abort_conn() runs.

To your second question. 
Yes I meant fuse_dev_release().

> 
> Thanks,
> Joanne
> >

Thanks,
Horst

  reply	other threads:[~2026-04-10 21:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 21:33 [PATCH 0/2] fuse: Fix possible memleak at startup with immediate teardown Bernd Schubert
2025-10-21 21:33 ` [PATCH 1/2] fuse: Move ring queues_refs decrement Bernd Schubert
2025-10-21 21:33 ` [PATCH 2/2] fs/fuse: fix potential memory leak from fuse_uring_cancel Bernd Schubert
2026-04-09 11:02 ` [PATCH 0/2] fuse: Fix possible memleak at startup with immediate teardown Bernd Schubert
2026-04-09 23:09   ` Joanne Koong
2026-04-10  7:21     ` Horst Birthelmer
2026-04-10 17:09       ` Joanne Koong
2026-04-10 17:18         ` Bernd Schubert
2026-04-10 17:28           ` Joanne Koong
2026-04-10 17:32             ` Bernd Schubert
2026-04-10 19:53               ` Joanne Koong
2026-04-10 18:55         ` Re: " Horst Birthelmer
2026-04-10 20:09           ` Joanne Koong
2026-04-10 21:49             ` Horst Birthelmer [this message]
2026-04-10 11:26     ` Bernd Schubert
2026-04-10 21:24       ` Joanne Koong
2026-04-10 22:08         ` Horst Birthelmer

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=adlpMVjXfOKyIUPr@fedora \
    --to=horst@birthelmer.de \
    --cc=ali@ddn.com \
    --cc=bernd@bsbernd.com \
    --cc=bschubert@ddn.com \
    --cc=hbirthelmer@ddn.com \
    --cc=joannelkoong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --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