[PATCH 4/8] fuse: signal that a fuse filesystem should exhibit local fs behaviors

Darrick J. Wong
2025-09-16T00:25:04Z

Create a new fuse context flag that indicates that the kernel should
implement various local filesystem behaviors instead of passing vfs
commands straight through to the fuse server and expecting the server to
do all the work. For example, this means that we'll use the kernel to
transform some ACL updates into mode changes, and later to do
enforcement of the immutable and append iflags.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/fuse/fuse_i.h | 4 ++++
fs/fuse/inode.c | 2 ++
2 files changed, 6 insertions(+)

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index e93a3c3f11d901..e13e8270f4f58d 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -603,6 +603,7 @@ struct fuse_fs_context {
bool no_control:1;
bool no_force_umount:1;
bool legacy_opts_show:1;
+ bool local_fs:1;
enum fuse_dax_mode dax_mode;
unsigned int max_read;
unsigned int blksize;
@@ -901,6 +902,9 @@ struct fuse_conn {
/* Is link not implemented by fs? */
unsigned int no_link:1;

+ /* Should this filesystem behave like a local filesystem? */
+ unsigned int local_fs:1;
+
/* Use io_uring for communication */
unsigned int io_uring;

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index c94aba627a6f11..c8dd0bcb7e6f9f 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1862,6 +1862,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
fc->destroy = ctx->destroy;
fc->no_control = ctx->no_control;
fc->no_force_umount = ctx->no_force_umount;
+ fc->local_fs = ctx->local_fs;

err = -ENOMEM;
root = fuse_get_root_inode(sb, ctx->rootmode);
@@ -2029,6 +2030,7 @@ static int fuse_init_fs_context(struct fs_context *fsc)
if (fsc->fs_type == &fuseblk_fs_type) {
ctx->is_bdev = true;
ctx->destroy = true;
+ ctx->local_fs = true;
}
#endif