Re: [PATCH 2/2] fuse: don't wait for a sync-init mount in fuse_uring_cmd()

From: Yun Wang

Date: Thu Nov 19 2026 - 18:03:39 EST


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