]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fuse: create fuse_dev on /dev/fuse open instead of mount
authorMiklos Szeredi <mszeredi@redhat.com>
Wed, 11 Mar 2026 20:02:41 +0000 (21:02 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 2 Apr 2026 18:43:24 +0000 (20:43 +0200)
commita8dd5f1b73bc533e1192d38c82fc144595d3ce9a
tree00b9f4425e3ff4deaf57204e81e7b896f11a9045
parente45f591f704aecec31dc738694a5e43acdfd020b
fuse: create fuse_dev on /dev/fuse open instead of mount

Allocate struct fuse_dev when opening the device.  This means that unlike
before, ->private_data is always set to a valid pointer.

The use of USE_DEV_SYNC_INIT magic pointer for the private_data is now
replaced with a simple bool sync_init member.

If sync INIT is not set, I/O on the device returns error before mount.
Keep this behavior by checking for the ->fc member.  If fud->fc is set, the
mount has succeeded.  Testing this used READ_ONCE(file->private_data) and
smp_mb() to try and provide the necessary semantics.  Switch this to
smp_store_release() and smp_load_acquire().

Setting fud->fc is protected by fuse_mutex, this is unchanged.

Will need this later so the /dev/fuse open file reference is not held
during FSCONFIG_CMD_CREATE.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
fs/fuse/dev.c
fs/fuse/fuse_dev_i.h
fs/fuse/fuse_i.h
fs/fuse/inode.c
fs/fuse/virtio_fs.c