Re: [PATCH 0/6] vfs: properly deny directory leases on filesystems with special lease handling

From: Jeff Layton

Date: Wed Jan 07 2026 - 10:44:04 EST


On Wed, 2026-01-07 at 07:32 -0800, Christoph Hellwig wrote:
> On Wed, Jan 07, 2026 at 09:20:08AM -0500, Jeff Layton wrote:
> > Long term, I think it would be best to change leases/delegations to be
> > an opt-in thing, such that leases are always denied by default if the
> > method isn't set.
>
> Agreed.
>
> > That's a larger patchset though as we'd need to audit
> > all of the file_operations that currently have ->setlease() as NULL.
>
> Initially you can just wire them up everywhere. But I guess that would
> be overkill.

That is probably the simplest approach, but there are literally
thousands of file_operations structures. Most are in driver code and
have no business dealing with leases. Technically, I guess you can set
a lease on those fd's today, but likely no one ever does it. We
probably also don't really need lease support in (e.g.) sysfs, debugfs,
etc. I'm not sure if there is anything that prevents them there.

I think what we probably want to do is wire them up in most filesystems
under fs/. Basically, in anything that might reasonably be exportable
via NFS or SMB, and have the rest deny them.

We might get a few regressions with that approach but if so we would
have an opportunity to dig into why people are setting leases on these
more "exotic" filesystems too.

--
Jeff Layton <jlayton@xxxxxxxxxx>