mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] fuse: don't wait for a sync-init mount in non-blocking reads and uring_cmd
@ 2026-11-19 11:35 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:36 ` [PATCH 2/2] fuse: don't wait for a sync-init mount in fuse_uring_cmd() Yun Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Yun Wang @ 2026-11-19 11:35 UTC (permalink / raw)
  Cc: Bernd Schubert, Joanne Koong, fuse-devel, linux-kernel

Since commit dfb84c330794 ("fuse: allow synchronous FUSE_INIT"), a
/dev/fuse fd with FUSE_DEV_IOC_SYNC_INIT waits in fuse_get_dev() until
the mount installs the channel.  That suits a blocking read, but
fuse_get_dev() is also called from O_NONBLOCK reads and from
fuse_uring_cmd(), so these sleep before the mount as well, until the
mount or a signal:

 - read(2) and splice(2) with O_NONBLOCK.
 - IORING_OP_URING_CMD, from the task that called io_uring_enter(2),
   also with fuse-over-io-uring disabled.  Other submissions on the
   same ring wait as well.

It happens on every kernel I tried since v6.18: v6.18 to v7.3 in QEMU,
7.2 and 7.4-rc2 on bare metal.  v6.17 has no FUSE_DEV_IOC_SYNC_INIT.

The same wait has caused trouble before.  a8dd5f1b73bc ("fuse: create
fuse_dev on /dev/fuse open instead of mount") made fds without sync
init wait there as well, and LTP's read_all, which reads every file
under /dev with O_NONBLOCK, then hung on /dev/fuse [1].  9f6f44aa5a58
("fuse: don't block in fuse_get_dev() for non-sync_init case") fixed
that by returning -EPERM again for those fds.  A sync-init fd still
waits, as dfb84c330794 intends for a blocking read; these two patches
take the wait out of the non-blocking read paths and fuse_uring_cmd()
and keep it for the others.

Patch 1 makes O_NONBLOCK reads before the mount return -EAGAIN, the
same as after the mount while no request is queued.  Patch 2 makes
fuse_uring_cmd() return at once the -EAGAIN it returns before FUSE_INIT
anyway.  fuse_get_dev() itself is unchanged.

->poll has the same problem: poll(2), epoll_ctl(2) and io_uring reads
of a sync-init fd sleep before the mount too, which is what libfuse's
sync-init worker ran into [2].  That fix is bigger, since a poller that
registers before the mount has no fiq->waitq to wait on, so I will
send it separately, together with a selftest for all of these paths.

Tested in QEMU (virtme-ng) on 7.4-rc2 (067c5c24cef2): with both patches,
O_NONBLOCK read(2) and splice(2) and IORING_OP_URING_CMD on a sync-init
fd that is never mounted return -EAGAIN at once, a blocking read still
waits until a signal, and an fd without sync init still gets -EPERM.
The poll, epoll and mount tests still wait, as expected without the
->poll fix.

The patches are against 7.4-rc2 (067c5c24cef2) and also apply to
fuse.git for-next (ab9787d7e66a).  The Fixes tags point at
dfb84c330794 because the wait goes back to v6.18, but the patches only
apply from v7.2 on; older trees would need their own version.

[1] https://lore.kernel.org/all/3c9f8396-41f4-4c88-b883-34bede72b427@sirena.org.uk/
[2] https://github.com/libfuse/libfuse/pull/1633

Yun Wang (2):
  fuse: don't wait for a sync-init mount in non-blocking reads
  fuse: don't wait for a sync-init mount in fuse_uring_cmd()

 fs/fuse/dev.c        | 12 ++++++++++--
 fs/fuse/dev_uring.c  | 10 ++++++++--
 fs/fuse/fuse_dev_i.h | 14 ++++++++++++++
 3 files changed, 32 insertions(+), 4 deletions(-)


base-commit: 067c5c24cef23d913b67eaaf71ae67e7169a6620
-- 
2.56.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-19 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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

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®