On Tue, 2024-03-26 at 10:47 +0100, Miklos Szeredi wrote: > 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... > Yeah, it's a tough call. My hope was that FUSE drivers that did want lease support can just set the flag and and rebuild. Worst case, they'd just lose lease support until that was done. Lease support is generally an optimization, so things should still work but may be slower. > 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? > No, that seems like it would work just as well. I can respin the patch along those lines and resend. -- Jeff Layton <jlayton@xxxxxxxxxx>