mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yun Wang <arsenova@a7snv.com>
To: Bernd Schubert <bernd@bsbernd.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Joanne Koong <joannelkoong@gmail.com>,
	fuse-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] fuse: don't wait for a sync-init mount in fuse_uring_cmd()
Date: Thu, 19 Nov 2026 23:03:25 +0000	[thread overview]
Message-ID: <179512937453.1413003.12323605080434867679@a7snv.com> (raw)
In-Reply-To: <7b2d361d-86f1-4064-a905-954a2dfe4ccf@bsbernd.com>

On 11/19/26 15:36, Bernd Schubert wrote:
> I think only with an old version of libfuse that was sending REGISTER
> before FUSE_INIT was processed. That was the reason I had added the
> -EAGAIN handler into libfuse.

Thanks, that matches today's code.  Released libfuse (3.18.x) doesn't
use sync init at all, and master sends REGISTER after the mount with
sync init since b584cdfd.  Just before that commit, master with sync
init still got -EAGAIN loops, but from a different window than the one
patch 2 changes: after the FUSE_INIT reply was written and before the
mount thread had set initialized.  I traced that libfuse with bpftrace
on 7.4-rc2 with and without the patches: every -EAGAIN found the device
installed and the connection not yet initialized; none found the device
not installed yet.  That window is the same with or without this
patch.

> Well, if libfuse isn't affect, why is this patch needed? If you have
> another fuse server, fix your fuse server? (And it confirms my personal
> opinion that we should aim for one userspace library.)

Because of what the kernel does while a REGISTER waits for the mount.
io_uring_enter(2) issues the command inline with IO_URING_F_NONBLOCK
while holding ctx->uring_lock, and fuse_uring_cmd() then sleeps in
fuse_get_dev() until the device is installed.  Any other thread that
submits to the same ring blocks on uring_lock in D state meanwhile,
whether or not the fd is O_NONBLOCK.  On 7.4-rc2: thread A sends a
REGISTER before the mount, thread B submits a NOP to the same ring
100 ms later; B stays in D state in io_uring_enter() until the mount
400 ms later, and when there is no mount, until thread A gets a signal.
With patch 2 both return at once.

So a server that sends REGISTER that early is buggy, but I don't think
the kernel should sleep in the non-blocking issue path with uring_lock
held because of it.  For such a server, patch 2 turns that sleep into
the -EAGAIN that fuse_uring_cmd() already returns until FUSE_INIT has
completed.  Would you be fine with keeping patch 2 as it is, with the
changelog fixed as discussed?

Thanks,
Yun


      reply	other threads:[~2026-11-19 23:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 11:35 [PATCH 0/2] fuse: don't wait for a sync-init mount in non-blocking reads and uring_cmd Yun Wang
2026-11-19 11:36 ` [PATCH 1/2] fuse: don't wait for a sync-init mount in non-blocking reads Yun Wang
2026-11-19 11:57   ` Bernd Schubert
2026-11-19 23:07     ` Yun Wang
2026-11-19 11:36 ` [PATCH 2/2] fuse: don't wait for a sync-init mount in fuse_uring_cmd() Yun Wang
2026-11-17 21:47   ` Bernd Schubert
2026-11-19 13:15     ` Yun Wang
2026-11-19 14:36       ` Bernd Schubert
2026-11-19 23:03         ` Yun Wang [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=179512937453.1413003.12323605080434867679@a7snv.com \
    --to=arsenova@a7snv.com \
    --cc=bernd@bsbernd.com \
    --cc=fuse-devel@lists.linux.dev \
    --cc=joannelkoong@gmail.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®