From: Jeff Layton <jlayton@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Luis de Bethencourt <luisbg@kernel.org>,
Salah Triki <salah.triki@gmail.com>,
Nicolas Pitre <nico@fluxnic.net>,
Christoph Hellwig <hch@infradead.org>,
Anders Larsen <al@alarsen.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>,
Yue Hu <zbestahu@gmail.com>,
Jeffle Xu <jefflexu@linux.alibaba.com>,
Sandeep Dhavale <dhavale@google.com>,
Hongbo Li <lihongbo22@huawei.com>,
Chunhai Guo <guochunhai@vivo.com>, Jan Kara <jack@suse.com>,
Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Jaegeuk Kim <jaegeuk@kernel.org>,
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
David Woodhouse <dwmw2@infradead.org>,
Richard Weinberger <richard@nod.at>,
Dave Kleikamp <shaggy@kernel.org>,
Ryusuke Konishi <konishi.ryusuke@gmail.com>,
Viacheslav Dubeyko <slava@dubeyko.com>,
Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
Joseph Qi <joseph.qi@linux.alibaba.com>,
Mike Marshall <hubcap@omnibond.com>,
Martin Brandenburg <martin@omnibond.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Amir Goldstein <amir73il@gmail.com>,
Phillip Lougher <phillip@squashfs.org.uk>,
Carlos Maiolino <cem@kernel.org>,
Hugh Dickins <hughd@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
Namjae Jeon <linkinjeon@kernel.org>,
Sungjong Seo <sj1557.seo@samsung.com>,
Yuezhang Mo <yuezhang.mo@sony.com>,
Chuck Lever <chuck.lever@oracle.com>,
Alexander Aring <alex.aring@gmail.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Dominique Martinet <asmadeus@codewreck.org>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Steve French <sfrench@samba.org>,
Paulo Alcantara <pc@manguebit.org>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>,
Bharath SM <bharathsm@microsoft.com>,
Hans de Goede <hansg@kernel.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-btrfs@vger.kernel.org, linux-erofs@lists.ozlabs.org,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-mtd@lists.infradead.org,
jfs-discussion@lists.sourceforge.net,
linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org,
linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-mm@kvack.org, gfs2@lists.linux.dev,
linux-doc@vger.kernel.org, v9fs@lists.linux.dev,
ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org
Subject: Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
Date: Thu, 08 Jan 2026 13:56:57 -0500 [thread overview]
Message-ID: <8af369636c32b868f83669c49aea708ca3b894ac.camel@kernel.org> (raw)
In-Reply-To: <m3mywef74xhcakianlrovrnaadnhzhfqjfusulkcnyioforfml@j2xnk7dzkmv4>
On Thu, 2026-01-08 at 18:40 +0100, Jan Kara wrote:
> On Thu 08-01-26 12:12:55, Jeff Layton wrote:
> > Yesterday, I sent patches to fix how directory delegation support is
> > handled on filesystems where the should be disabled [1]. That set is
> > appropriate for v6.19. For v7.0, I want to make lease support be more
> > opt-in, rather than opt-out:
> >
> > For historical reasons, when ->setlease() file_operation is set to NULL,
> > the default is to use the kernel-internal lease implementation. This
> > means that if you want to disable them, you need to explicitly set the
> > ->setlease() file_operation to simple_nosetlease() or the equivalent.
> >
> > This has caused a number of problems over the years as some filesystems
> > have inadvertantly allowed leases to be acquired simply by having left
> > it set to NULL. It would be better if filesystems had to opt-in to lease
> > support, particularly with the advent of directory delegations.
> >
> > This series has sets the ->setlease() operation in a pile of existing
> > local filesystems to generic_setlease() and then changes
> > kernel_setlease() to return -EINVAL when the setlease() operation is not
> > set.
> >
> > With this change, new filesystems will need to explicitly set the
> > ->setlease() operations in order to provide lease and delegation
> > support.
> >
> > I mainly focused on filesystems that are NFS exportable, since NFS and
> > SMB are the main users of file leases, and they tend to end up exporting
> > the same filesystem types. Let me know if I've missed any.
>
> So, what about kernfs and fuse? They seem to be exportable and don't have
> .setlease set...
>
Yes, FUSE needs this too. I'll add a patch for that.
As far as kernfs goes: AIUI, that's basically what sysfs and resctrl
are built on. Do we really expect people to set leases there?
I guess it's technically a regression since you could set them on those
sorts of files earlier, but people don't usually export kernfs based
filesystems via NFS or SMB, and that seems like something that could be
used to make mischief.
AFAICT, kernfs_export_ops is mostly to support open_by_handle_at(). See
commit aa8188253474 ("kernfs: add exportfs operations").
One idea: we could add a wrapper around generic_setlease() for
filesystems like this that will do a WARN_ONCE() and then call
generic_setlease(). That would keep leases working on them but we might
get some reports that would tell us who's setting leases on these files
and why.
Thanks for the review!
> >
> > [1]: https://lore.kernel.org/linux-fsdevel/20260107-setlease-6-19-v1-0-85f034abcc57@kernel.org/
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > Jeff Layton (24):
> > fs: add setlease to generic_ro_fops and read-only filesystem directory operations
> > affs: add setlease file operation
> > btrfs: add setlease file operation
> > erofs: add setlease file operation
> > ext2: add setlease file operation
> > ext4: add setlease file operation
> > exfat: add setlease file operation
> > f2fs: add setlease file operation
> > fat: add setlease file operation
> > gfs2: add a setlease file operation
> > jffs2: add setlease file operation
> > jfs: add setlease file operation
> > nilfs2: add setlease file operation
> > ntfs3: add setlease file operation
> > ocfs2: add setlease file operation
> > orangefs: add setlease file operation
> > overlayfs: add setlease file operation
> > squashfs: add setlease file operation
> > tmpfs: add setlease file operation
> > udf: add setlease file operation
> > ufs: add setlease file operation
> > xfs: add setlease file operation
> > filelock: default to returning -EINVAL when ->setlease operation is NULL
> > fs: remove simple_nosetlease()
> >
> > Documentation/filesystems/porting.rst | 9 +++++++++
> > Documentation/filesystems/vfs.rst | 9 ++++++---
> > fs/9p/vfs_dir.c | 2 --
> > fs/9p/vfs_file.c | 2 --
> > fs/affs/dir.c | 2 ++
> > fs/affs/file.c | 2 ++
> > fs/befs/linuxvfs.c | 2 ++
> > fs/btrfs/file.c | 2 ++
> > fs/btrfs/inode.c | 2 ++
> > fs/ceph/dir.c | 2 --
> > fs/ceph/file.c | 1 -
> > fs/cramfs/inode.c | 2 ++
> > fs/efs/dir.c | 2 ++
> > fs/erofs/data.c | 2 ++
> > fs/erofs/dir.c | 2 ++
> > fs/exfat/dir.c | 2 ++
> > fs/exfat/file.c | 2 ++
> > fs/ext2/dir.c | 2 ++
> > fs/ext2/file.c | 2 ++
> > fs/ext4/dir.c | 2 ++
> > fs/ext4/file.c | 2 ++
> > fs/f2fs/dir.c | 2 ++
> > fs/f2fs/file.c | 2 ++
> > fs/fat/dir.c | 2 ++
> > fs/fat/file.c | 2 ++
> > fs/freevxfs/vxfs_lookup.c | 2 ++
> > fs/fuse/dir.c | 1 -
> > fs/gfs2/file.c | 3 +--
> > fs/isofs/dir.c | 2 ++
> > fs/jffs2/dir.c | 2 ++
> > fs/jffs2/file.c | 2 ++
> > fs/jfs/file.c | 2 ++
> > fs/jfs/namei.c | 2 ++
> > fs/libfs.c | 20 ++------------------
> > fs/locks.c | 3 +--
> > fs/nfs/dir.c | 1 -
> > fs/nfs/file.c | 1 -
> > fs/nilfs2/dir.c | 3 ++-
> > fs/nilfs2/file.c | 2 ++
> > fs/ntfs3/dir.c | 3 +++
> > fs/ntfs3/file.c | 3 +++
> > fs/ocfs2/file.c | 5 +++++
> > fs/orangefs/dir.c | 4 +++-
> > fs/orangefs/file.c | 1 +
> > fs/overlayfs/file.c | 2 ++
> > fs/overlayfs/readdir.c | 2 ++
> > fs/qnx4/dir.c | 2 ++
> > fs/qnx6/dir.c | 2 ++
> > fs/read_write.c | 2 ++
> > fs/smb/client/cifsfs.c | 1 -
> > fs/squashfs/dir.c | 2 ++
> > fs/squashfs/file.c | 4 +++-
> > fs/udf/dir.c | 2 ++
> > fs/udf/file.c | 2 ++
> > fs/ufs/dir.c | 2 ++
> > fs/ufs/file.c | 2 ++
> > fs/vboxsf/dir.c | 1 -
> > fs/vboxsf/file.c | 1 -
> > fs/xfs/xfs_file.c | 3 +++
> > include/linux/fs.h | 1 -
> > mm/shmem.c | 2 ++
> > 61 files changed, 116 insertions(+), 42 deletions(-)
> > ---
> > base-commit: 731ce71a6c8adb8b8f873643beacaeedc1564500
> > change-id: 20260107-setlease-6-20-299eb5695c5a
> >
> > Best regards,
> > --
> > Jeff Layton <jlayton@kernel.org>
> >
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-01-08 18:57 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 17:12 Jeff Layton
2026-01-08 17:12 ` [PATCH 01/24] fs: add setlease to generic_ro_fops and read-only filesystem directory operations Jeff Layton
2026-01-08 17:26 ` Jan Kara
2026-01-08 17:12 ` [PATCH 02/24] affs: add setlease file operation Jeff Layton
2026-01-08 21:26 ` David Sterba
2026-01-08 17:12 ` [PATCH 03/24] btrfs: " Jeff Layton
2026-01-08 21:26 ` David Sterba
2026-01-08 17:12 ` [PATCH 04/24] erofs: " Jeff Layton
2026-01-10 1:47 ` Chao Yu
2026-01-08 17:13 ` [PATCH 05/24] ext2: " Jeff Layton
2026-01-08 17:28 ` Jan Kara
2026-01-08 17:13 ` [PATCH 06/24] ext4: " Jeff Layton
2026-01-08 17:28 ` Jan Kara
2026-01-08 17:13 ` [PATCH 07/24] exfat: " Jeff Layton
2026-01-08 22:47 ` Namjae Jeon
2026-01-08 17:13 ` [PATCH 08/24] f2fs: " Jeff Layton
2026-01-10 1:47 ` Chao Yu
2026-01-08 17:13 ` [PATCH 09/24] fat: " Jeff Layton
2026-01-08 18:12 ` OGAWA Hirofumi
2026-01-08 17:13 ` [PATCH 10/24] gfs2: add a " Jeff Layton
2026-01-08 17:13 ` [PATCH 11/24] jffs2: add " Jeff Layton
2026-01-09 8:49 ` Richard Weinberger
2026-01-08 17:13 ` [PATCH 12/24] jfs: " Jeff Layton
2026-01-08 19:46 ` Dave Kleikamp
2026-01-09 7:40 ` Richard Weinberger
2026-01-09 8:48 ` Richard Weinberger
2026-01-08 17:13 ` [PATCH 13/24] nilfs2: " Jeff Layton
2026-01-09 5:26 ` Ryusuke Konishi
2026-01-08 17:13 ` [PATCH 14/24] ntfs3: " Jeff Layton
2026-01-08 17:13 ` [PATCH 15/24] ocfs2: " Jeff Layton
2026-01-08 17:29 ` Jan Kara
2026-01-08 17:13 ` [PATCH 16/24] orangefs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 17/24] overlayfs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 18/24] squashfs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 19/24] tmpfs: " Jeff Layton
2026-01-08 17:31 ` Jan Kara
2026-01-08 17:13 ` [PATCH 20/24] udf: " Jeff Layton
2026-01-08 17:29 ` Jan Kara
2026-01-08 17:13 ` [PATCH 21/24] ufs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 22/24] xfs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 23/24] filelock: default to returning -EINVAL when ->setlease operation is NULL Jeff Layton
2026-01-08 17:34 ` Jan Kara
2026-01-08 17:13 ` [PATCH 24/24] fs: remove simple_nosetlease() Jeff Layton
2026-01-08 17:34 ` Jan Kara
2026-01-08 17:40 ` [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jan Kara
2026-01-08 18:56 ` Jeff Layton [this message]
2026-01-09 9:26 ` Jan Kara
2026-01-09 18:52 ` Amir Goldstein
2026-01-09 6:00 ` Christoph Hellwig
2026-01-09 8:03 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8af369636c32b868f83669c49aea708ca3b894ac.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=adilger.kernel@dilger.ca \
--cc=agruenba@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=al@alarsen.net \
--cc=alex.aring@gmail.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=amir73il@gmail.com \
--cc=anna@kernel.org \
--cc=asmadeus@codewreck.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bharathsm@microsoft.com \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=chao@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=clm@fb.com \
--cc=corbet@lwn.net \
--cc=devel@lists.orangefs.org \
--cc=dhavale@google.com \
--cc=dsterba@suse.com \
--cc=dwmw2@infradead.org \
--cc=ericvh@kernel.org \
--cc=gfs2@lists.linux.dev \
--cc=guochunhai@vivo.com \
--cc=hansg@kernel.org \
--cc=hch@infradead.org \
--cc=hirofumi@mail.parknet.co.jp \
--cc=hubcap@omnibond.com \
--cc=hughd@google.com \
--cc=idryomov@gmail.com \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=jaegeuk@kernel.org \
--cc=jefflexu@linux.alibaba.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jlbec@evilplan.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=konishi.ryusuke@gmail.com \
--cc=lihongbo22@huawei.com \
--cc=linkinjeon@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=luisbg@kernel.org \
--cc=mark@fasheh.com \
--cc=martin@omnibond.com \
--cc=miklos@szeredi.hu \
--cc=nico@fluxnic.net \
--cc=ntfs3@lists.linux.dev \
--cc=ocfs2-devel@lists.linux.dev \
--cc=pc@manguebit.org \
--cc=phillip@squashfs.org.uk \
--cc=richard@nod.at \
--cc=ronniesahlberg@gmail.com \
--cc=salah.triki@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=shaggy@kernel.org \
--cc=sj1557.seo@samsung.com \
--cc=slava@dubeyko.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=trondmy@kernel.org \
--cc=tytso@mit.edu \
--cc=v9fs@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=xiang@kernel.org \
--cc=xiubli@redhat.com \
--cc=yuezhang.mo@sony.com \
--cc=zbestahu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox