Re: [PATCH 1/5] fuse: allow synchronous FUSE_INIT

Joanne Koong
2025-09-17T17:22:33Z

On Mon, Sep 15, 2025 at 5:26 PM Darrick J. Wong <djwong@kernel.org> wrote:
>
> From: Miklos Szeredi <mszeredi@redhat.com>
>
> FUSE_INIT has always been asynchronous with mount. That means that the
> server processed this request after the mount syscall returned.
>
> This means that FUSE_INIT can't supply the root inode's ID, hence it
> currently has a hardcoded value. There are other limitations such as not
> being able to perform getxattr during mount, which is needed by selinux.
>
> To remove these limitations allow server to process FUSE_INIT while
> initializing the in-core super block for the fuse filesystem. This can
> only be done if the server is prepared to handle this, so add
> FUSE_DEV_IOC_SYNC_INIT ioctl, which
>
> a) lets the server know whether this feature is supported, returning
> ENOTTY othewrwise.
>
> b) lets the kernel know to perform a synchronous initialization
>
> The implementation is slightly tricky, since fuse_dev/fuse_conn are set up
> only during super block creation. This is solved by setting the private
> data of the fuse device file to a special value ((struct fuse_dev *) 1) and
> waiting for this to be turned into a proper fuse_dev before commecing with
> operations on the device file.
>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
> fs/fuse/fuse_dev_i.h | 13 +++++++-
> fs/fuse/fuse_i.h | 5 ++-
> include/uapi/linux/fuse.h | 1 +
> fs/fuse/cuse.c | 3 +-
> fs/fuse/dev.c | 74 +++++++++++++++++++++++++++++++++------------
> fs/fuse/dev_uring.c | 4 +-
> fs/fuse/inode.c | 50 ++++++++++++++++++++++++------
> 7 files changed, 115 insertions(+), 35 deletions(-)

btw, I think an updated version of this has already been merged into
the fuse for-next tree (commit dfb84c330794)

Thanks,
Joanne