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

Darrick J. Wong
2025-09-19T17:50:14Z

On Fri, Sep 19, 2025 at 11:24:09AM +0200, Miklos Szeredi wrote:
> On Thu, 18 Sept 2025 at 18:52, Darrick J. Wong <djwong@kernel.org> wrote:
> >
> > On Wed, Sep 17, 2025 at 10:18:40AM -0700, Joanne Koong wrote:
>
> > > If I'm understanding it correctly, fc->local_fs is set to true if it's
> > > a fuseblk device? Why do we need a new "ctx->local_fs" instead of
> > > reusing ctx->is_bdev?
> >
> > Eventually, enabling iomap will also set local_fs=1, as Miklos and I
> > sort of touched on a couple weeks ago:
> >
> > https://lore.kernel.org/linux-fsdevel/CAJfpegvmXnZc=nC4UGw5Gya2cAr-kR0s=WNecnMhdTM_mGyuUg@mail.gmail.com/
>
> I think it might be worth making this property per-inode. I.e. a
> distributed filesystem could allow one inode to be completely "owned"
> by one client. This would be similar to NFSv4 delegations and could
> be refined to read-only (shared) and read-write (exclusive) ownership.
> A local filesystem would have all inodes excusively owned.
>
> This's been long on my todo list and also have some prior experiments,
> so it's a good opportunity to start working on it again:)

Since I already have per-fs and per-inode iomap flags, I can add a
per-inode localfs flag pretty easily for v6. ATM I see 2 existing flags
and 5 proposed (out of 32 possible):

/**
* fuse_attr flags
*
* FUSE_ATTR_SUBMOUNT: Object is a submount root
* FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode
* FUSE_ATTR_IOMAP: Use iomap for this inode
* FUSE_ATTR_ATOMIC: Enable untorn writes
* FUSE_ATTR_SYNC: File writes are synchronous
* FUSE_ATTR_IMMUTABLE: File is immutable
* FUSE_ATTR_APPEND: File is append-only
*/

So we still have plenty of space.

Would you like to allow any server set the per-inode flag? Or would you
rather keep the per-fs flag and require that it's set before setting the
per-inode flag? That would be useful for privilege checking of the fuse
server.

--D

> Thanks,
> Miklos
>
>
>
>
>
>
> >
> > --D
> >
> > > Thanks,
> > > Joanne
> > >
> > > > 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
> > > >
> > > >