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

From: Yun Wang

Date: Thu Nov 19 2026 - 06:37:02 EST


fuse_uring_cmd() gets the device with fuse_get_dev(), which waits for
the mount of a device in sync-init mode. io_uring normally issues the
command from the task that called io_uring_enter(2), so an
IORING_OP_URING_CMD on such a device before the mount puts that task
to sleep until the mount or a signal. This happens before the
enable_uring check, so also when fuse-over-io-uring is disabled.

Until FUSE_INIT has completed, fuse_uring_cmd() returns -EAGAIN anyway
and the server has to send the command again later. Return -EAGAIN
at once when the device is not mounted yet either, using
fuse_get_dev_nowait() from the previous patch, and don't log "No fuse
device found" for it.

Fixes: dfb84c330794 ("fuse: allow synchronous FUSE_INIT")
Signed-off-by: Yun Wang <arsenova@xxxxxxxxx>
---
fs/fuse/dev_uring.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 460776cd69..0f725172ae 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -1664,9 +1664,15 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
if (!(issue_flags & IO_URING_F_SQE128))
return -EINVAL;

- fud = fuse_get_dev(cmd->file);
+ /*
+ * Don't wait for the mount of a sync-init device: this may run in
+ * the task that called io_uring_enter(), and the ring can't be
+ * registered before FUSE_INIT anyway, see the -EAGAIN below.
+ */
+ fud = fuse_get_dev_nowait(cmd->file);
if (IS_ERR(fud)) {
- pr_info_ratelimited("No fuse device found\n");
+ if (PTR_ERR(fud) != -EAGAIN)
+ pr_info_ratelimited("No fuse device found\n");
return PTR_ERR(fud);
}
fch = fud->chan;
--
2.56.1