]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fuse: add refcount to fuse_dev
authorMiklos Szeredi <mszeredi@redhat.com>
Wed, 11 Mar 2026 21:05:17 +0000 (22:05 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 2 Apr 2026 18:43:24 +0000 (20:43 +0200)
commite9bf38500ed9aec7cfdf9219c75d353645b41168
treed531d968cfd670f784d61f90ad4905d6ffb84c51
parenta8dd5f1b73bc533e1192d38c82fc144595d3ce9a
fuse: add refcount to fuse_dev

This will make it possible to grab the fuse_dev and subsequently release
the file that it came from.

In the above case, fud->fc will be set to FUSE_DEV_FC_DISCONNECTED to
indicate that this is no longer a functional device.

When trying to assign an fc to such a disconnected fuse_dev, the fc is set
to the disconnected state.

Use atomic operations xchg() and cmpxchg() to prevent races.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/cuse.c
fs/fuse/dev.c
fs/fuse/fuse_dev_i.h
fs/fuse/fuse_i.h
fs/fuse/inode.c
fs/fuse/virtio_fs.c