Re: [PATCH RFC] fuse: require FUSE drivers to opt-in for local file leases

From: Miklos Szeredi
Date: Tue Mar 26 2024 - 05:49:41 EST


On Tue, 19 Mar 2024 at 17:54, Jeff Layton <jlayton@xxxxxxxxxx> wrote:
>
> Traditionally, we've allowed people to set leases on FUSE inodes. Some
> FUSE drivers are effectively local filesystems and should be fine with
> kernel-internal lease support. But others are backed by a network server
> that may have multiple clients, or may be backed by something non-file
> like entirely.
>
> Have the filesytem driver to set a fuse_conn flag to indicate whether it
> wants support for local, in-kernel leases. If the flag is unset (the
> default), then setlease attempts will fail with -EINVAL, indicating that
> leases aren't supported on that inode.
>
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
> This is only tested for compilation, but it's fairly straightforward.
> Having the FUSE drivers opt-out of this support might be more
> backward-compatible, but that is a bit more dangerous. I'd rather driver
> maintainer consciously opt-in.

In the end the lease behavior will need to be reverted if there are
regressions. I really don't know which is worse, the risk of
regressions or the of risk data corruption...

Also I'd prefer a more general flag indicating that the the kernel
driver can assume no external changes to the filesystem. E.g.
FUSE_NO_OUTSIDE_CHANGE.

Does this make sense? Can you imagine a case where FUSE_LOCAL_LEASES
would be set, but caching policy would not assume no external changes?

Thanks,
Miklos