* [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
@ 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
` (26 more replies)
0 siblings, 27 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:12 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
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.
[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>
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 01/24] fs: add setlease to generic_ro_fops and read-only filesystem directory operations
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
@ 2026-01-08 17:12 ` Jeff Layton
2026-01-08 17:26 ` Jan Kara
2026-01-08 17:12 ` [PATCH 02/24] affs: add setlease file operation Jeff Layton
` (25 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:12 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to generic_ro_fops, which covers file
operations for several read-only filesystems (BEFS, EFS, ISOFS, QNX4,
QNX6, CRAMFS, FREEVXFS). Also add setlease to the directory
file_operations for these filesystems. A future patch will change the
default behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on these filesystems.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/befs/linuxvfs.c | 2 ++
fs/cramfs/inode.c | 2 ++
fs/efs/dir.c | 2 ++
fs/freevxfs/vxfs_lookup.c | 2 ++
fs/isofs/dir.c | 2 ++
fs/qnx4/dir.c | 2 ++
fs/qnx6/dir.c | 2 ++
fs/read_write.c | 2 ++
8 files changed, 16 insertions(+)
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 9fcfdd6b8189aaf5cc3b68aa8dff4798af5bdcbc..d7c5d9270387bf6c3e94942e6331b449f90fe428 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -14,6 +14,7 @@
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
#include <linux/errno.h>
+#include <linux/filelock.h>
#include <linux/stat.h>
#include <linux/nls.h>
#include <linux/buffer_head.h>
@@ -79,6 +80,7 @@ static const struct file_operations befs_dir_operations = {
.read = generic_read_dir,
.iterate_shared = befs_readdir,
.llseek = generic_file_llseek,
+ .setlease = generic_setlease,
};
static const struct inode_operations befs_dir_inode_operations = {
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index e54ebe402df79d43a2c7cf491d669829f7ef81b7..41b1a869cf135d014003d6bf1c343d590ae7a084 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -16,6 +16,7 @@
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/file.h>
+#include <linux/filelock.h>
#include <linux/pagemap.h>
#include <linux/ramfs.h>
#include <linux/init.h>
@@ -938,6 +939,7 @@ static const struct file_operations cramfs_directory_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = cramfs_readdir,
+ .setlease = generic_setlease,
};
static const struct inode_operations cramfs_dir_inode_operations = {
diff --git a/fs/efs/dir.c b/fs/efs/dir.c
index f892ac7c2a35e0094a314eeded06a974154e46d7..35ad0092c11547af68ef8baf4965b50a0a7593fe 100644
--- a/fs/efs/dir.c
+++ b/fs/efs/dir.c
@@ -6,6 +6,7 @@
*/
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include "efs.h"
static int efs_readdir(struct file *, struct dir_context *);
@@ -14,6 +15,7 @@ const struct file_operations efs_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = efs_readdir,
+ .setlease = generic_setlease,
};
const struct inode_operations efs_dir_inode_operations = {
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
index 1b0bca8b4cc686043d92246042dcf833d37712e4..138e08de976ea762a46043316f27e9a031f60c32 100644
--- a/fs/freevxfs/vxfs_lookup.c
+++ b/fs/freevxfs/vxfs_lookup.c
@@ -8,6 +8,7 @@
* Veritas filesystem driver - lookup and other directory related code.
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/highmem.h>
@@ -36,6 +37,7 @@ const struct file_operations vxfs_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = vxfs_readdir,
+ .setlease = generic_setlease,
};
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 09df40b612fbf27a1a93af2b4fbf6a607f4a1ab4..2ca16c3fe5ef3427e5bbd0631eb8323ef3c58bf1 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -12,6 +12,7 @@
* isofs directory handling functions
*/
#include <linux/gfp.h>
+#include <linux/filelock.h>
#include "isofs.h"
int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode)
@@ -271,6 +272,7 @@ const struct file_operations isofs_dir_operations =
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = isofs_readdir,
+ .setlease = generic_setlease,
};
/*
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index 42a529e26bd68b6de1a7738c409d5942a92066f8..6402715ab377e5686558371dd76e5a4c1cfbb787 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -13,6 +13,7 @@
*/
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include "qnx4.h"
static int qnx4_readdir(struct file *file, struct dir_context *ctx)
@@ -71,6 +72,7 @@ const struct file_operations qnx4_dir_operations =
.read = generic_read_dir,
.iterate_shared = qnx4_readdir,
.fsync = generic_file_fsync,
+ .setlease = generic_setlease,
};
const struct inode_operations qnx4_dir_inode_operations =
diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c
index b4d10e45f2e41b45568fe813a3cc0aa253bcab6e..ae0c9846833d916beb7f356cfa6e9de01a6f6963 100644
--- a/fs/qnx6/dir.c
+++ b/fs/qnx6/dir.c
@@ -11,6 +11,7 @@
*
*/
+#include <linux/filelock.h>
#include "qnx6.h"
static unsigned qnx6_lfile_checksum(char *name, unsigned size)
@@ -275,6 +276,7 @@ const struct file_operations qnx6_dir_operations = {
.read = generic_read_dir,
.iterate_shared = qnx6_readdir,
.fsync = generic_file_fsync,
+ .setlease = generic_setlease,
};
const struct inode_operations qnx6_dir_inode_operations = {
diff --git a/fs/read_write.c b/fs/read_write.c
index 833bae068770a4e410e4895132586313a9687fa2..50bff7edc91f36fe5ee24198bd51a33c278d40a2 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -20,6 +20,7 @@
#include <linux/compat.h>
#include <linux/mount.h>
#include <linux/fs.h>
+#include <linux/filelock.h>
#include "internal.h"
#include <linux/uaccess.h>
@@ -30,6 +31,7 @@ const struct file_operations generic_ro_fops = {
.read_iter = generic_file_read_iter,
.mmap_prepare = generic_file_readonly_mmap_prepare,
.splice_read = filemap_splice_read,
+ .setlease = generic_setlease,
};
EXPORT_SYMBOL(generic_ro_fops);
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 02/24] affs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support 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:12 ` Jeff Layton
2026-01-08 21:26 ` David Sterba
2026-01-08 17:12 ` [PATCH 03/24] btrfs: " Jeff Layton
` (24 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:12 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to affs_file_operations and
affs_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/affs/dir.c | 2 ++
fs/affs/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index bd40d5f0881042e7e6b15b09a76a1793169a1d50..fe18caaf4d6557c67f5c0542ad86a6fe4c512aaf 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -15,6 +15,7 @@
*/
#include <linux/iversion.h>
+#include <linux/filelock.h>
#include "affs.h"
struct affs_dir_data {
@@ -55,6 +56,7 @@ const struct file_operations affs_dir_operations = {
.iterate_shared = affs_readdir,
.fsync = affs_file_fsync,
.release = affs_dir_release,
+ .setlease = generic_setlease,
};
/*
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 765c3443663e6f542dce2ad5d9e055e14b0574e3..6c9258359ddb9ba344976dd5a9a435f71f3fabc1 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -15,6 +15,7 @@
#include <linux/uio.h>
#include <linux/blkdev.h>
+#include <linux/filelock.h>
#include <linux/mpage.h>
#include "affs.h"
@@ -1008,6 +1009,7 @@ const struct file_operations affs_file_operations = {
.release = affs_file_release,
.fsync = affs_file_fsync,
.splice_read = filemap_splice_read,
+ .setlease = generic_setlease,
};
const struct inode_operations affs_file_inode_operations = {
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 03/24] btrfs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support 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:12 ` [PATCH 02/24] affs: add setlease file operation Jeff Layton
@ 2026-01-08 17:12 ` Jeff Layton
2026-01-08 21:26 ` David Sterba
2026-01-08 17:12 ` [PATCH 04/24] erofs: " Jeff Layton
` (23 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:12 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to btrfs_file_operations and
btrfs_dir_file_operations, pointing to generic_setlease. A future
patch will change the default behavior to reject lease attempts with
-EINVAL when there is no setlease file operation defined. Add
generic_setlease to retain the ability to set leases on this
filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/btrfs/file.c | 2 ++
fs/btrfs/inode.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 1abc7ed2990e0e956dc0550cba8b0cfc90109e65..aca2b541e72df3638bdc6cd7551a018ae959039b 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -10,6 +10,7 @@
#include <linux/string.h>
#include <linux/backing-dev.h>
#include <linux/falloc.h>
+#include <linux/filelock.h>
#include <linux/writeback.h>
#include <linux/compat.h>
#include <linux/slab.h>
@@ -3867,6 +3868,7 @@ const struct file_operations btrfs_file_operations = {
.remap_file_range = btrfs_remap_file_range,
.uring_cmd = btrfs_uring_cmd,
.fop_flags = FOP_BUFFER_RASYNC | FOP_BUFFER_WASYNC,
+ .setlease = generic_setlease,
};
int btrfs_fdatawrite_range(struct btrfs_inode *inode, loff_t start, loff_t end)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 599c03a1c5737ee4129c0bc1743b345847fa5dfc..5d1bdc862ed2711e349af085512f3bda6cb63278 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8,6 +8,7 @@
#include <linux/bio.h>
#include <linux/blk-cgroup.h>
#include <linux/file.h>
+#include <linux/filelock.h>
#include <linux/fs.h>
#include <linux/fs_struct.h>
#include <linux/pagemap.h>
@@ -10573,6 +10574,7 @@ static const struct file_operations btrfs_dir_file_operations = {
#endif
.release = btrfs_release_file,
.fsync = btrfs_sync_file,
+ .setlease = generic_setlease,
};
/*
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 04/24] erofs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (2 preceding siblings ...)
2026-01-08 17:12 ` [PATCH 03/24] btrfs: " Jeff Layton
@ 2026-01-08 17:12 ` Jeff Layton
2026-01-10 1:47 ` Chao Yu
2026-01-08 17:13 ` [PATCH 05/24] ext2: " Jeff Layton
` (22 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:12 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to erofs_file_fops and erofs_dir_fops,
pointing to generic_setlease. A future patch will change the default
behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/erofs/data.c | 2 ++
fs/erofs/dir.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index bb13c4cb845563492a616fc000910112b92df555..e2941b4715616528ddede2dbb9c0744db5d11be5 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -5,6 +5,7 @@
* Copyright (C) 2021, Alibaba Cloud
*/
#include "internal.h"
+#include <linux/filelock.h>
#include <linux/sched/mm.h>
#include <trace/events/erofs.h>
@@ -483,4 +484,5 @@ const struct file_operations erofs_file_fops = {
.mmap_prepare = erofs_file_mmap_prepare,
.get_unmapped_area = thp_get_unmapped_area,
.splice_read = filemap_splice_read,
+ .setlease = generic_setlease,
};
diff --git a/fs/erofs/dir.c b/fs/erofs/dir.c
index 32b4f5aa60c986dc2acf209960ff6df4077c7aa1..e5132575b9d3ef958a8acbe80bd0d2ddbd865135 100644
--- a/fs/erofs/dir.c
+++ b/fs/erofs/dir.c
@@ -5,6 +5,7 @@
* Copyright (C) 2022, Alibaba Cloud
*/
#include "internal.h"
+#include <linux/filelock.h>
static int erofs_fill_dentries(struct inode *dir, struct dir_context *ctx,
void *dentry_blk, struct erofs_dirent *de,
@@ -127,4 +128,5 @@ const struct file_operations erofs_dir_fops = {
#ifdef CONFIG_COMPAT
.compat_ioctl = erofs_compat_ioctl,
#endif
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 05/24] ext2: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (3 preceding siblings ...)
2026-01-08 17:12 ` [PATCH 04/24] erofs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:28 ` Jan Kara
2026-01-08 17:13 ` [PATCH 06/24] ext4: " Jeff Layton
` (21 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to ext2_file_operations and
ext2_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ext2/dir.c | 2 ++
fs/ext2/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index b07b3b369710c4848d6091742cdd0b5c42d4674d..395fc36c089b7bb6360a8326727bd5606c7e2476 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -24,6 +24,7 @@
#include "ext2.h"
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
#include <linux/iversion.h>
@@ -734,4 +735,5 @@ const struct file_operations ext2_dir_operations = {
.compat_ioctl = ext2_compat_ioctl,
#endif
.fsync = ext2_fsync,
+ .setlease = generic_setlease,
};
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 76bddce462fced77b24d64416cb9fdb172d8270b..ebe356a38b185e0d8662f704ad20e42fe618284e 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -22,6 +22,7 @@
#include <linux/time.h>
#include <linux/pagemap.h>
#include <linux/dax.h>
+#include <linux/filelock.h>
#include <linux/quotaops.h>
#include <linux/iomap.h>
#include <linux/uio.h>
@@ -325,6 +326,7 @@ const struct file_operations ext2_file_operations = {
.get_unmapped_area = thp_get_unmapped_area,
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
+ .setlease = generic_setlease,
};
const struct inode_operations ext2_file_inode_operations = {
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 06/24] ext4: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (4 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 05/24] ext2: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:28 ` Jan Kara
2026-01-08 17:13 ` [PATCH 07/24] exfat: " Jeff Layton
` (20 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to ext4_file_operations and
ext4_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ext4/dir.c | 2 ++
fs/ext4/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 256fe2c1d4c1619eb2cd915d8b6b05bce72656e7..00c4b3c82b6534790962dc3964c0c557162b6dff 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -24,6 +24,7 @@
#include <linux/fs.h>
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include <linux/slab.h>
#include <linux/iversion.h>
#include <linux/unicode.h>
@@ -690,4 +691,5 @@ const struct file_operations ext4_dir_operations = {
#endif
.fsync = ext4_sync_file,
.release = ext4_release_dir,
+ .setlease = generic_setlease,
};
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 7a8b3093218921f26a7f8962f94739ba49431230..534cf864101f8d1e5f4106b61c0580c858bc0e27 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -25,6 +25,7 @@
#include <linux/mount.h>
#include <linux/path.h>
#include <linux/dax.h>
+#include <linux/filelock.h>
#include <linux/quotaops.h>
#include <linux/pagevec.h>
#include <linux/uio.h>
@@ -980,6 +981,7 @@ const struct file_operations ext4_file_operations = {
.fop_flags = FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
FOP_DIO_PARALLEL_WRITE |
FOP_DONTCACHE,
+ .setlease = generic_setlease,
};
const struct inode_operations ext4_file_inode_operations = {
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 07/24] exfat: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (5 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 06/24] ext4: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 22:47 ` Namjae Jeon
2026-01-08 17:13 ` [PATCH 08/24] f2fs: " Jeff Layton
` (19 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to exfat_file_operations and
exfat_dir_operations, pointing to generic_setlease. A future patch
will change the default behavior to reject lease attempts with -EINVAL
when there is no setlease file operation defined. Add generic_setlease
to retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/exfat/dir.c | 2 ++
fs/exfat/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 3045a58e124ae0f193af2caeef7261b20fe42e00..2dbf335eafefc5f51a5c70598786c35b85e2118d 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -7,6 +7,7 @@
#include <linux/compat.h>
#include <linux/bio.h>
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include "exfat_raw.h"
#include "exfat_fs.h"
@@ -298,6 +299,7 @@ const struct file_operations exfat_dir_operations = {
.compat_ioctl = exfat_compat_ioctl,
#endif
.fsync = exfat_file_fsync,
+ .setlease = generic_setlease,
};
int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu)
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index 536c8078f0c192688eed5f5ee86dd1bc738be84f..b60ee0e1bec9344145a6328cdd727e35b317c08a 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -12,6 +12,7 @@
#include <linux/security.h>
#include <linux/msdos_fs.h>
#include <linux/writeback.h>
+#include <linux/filelock.h>
#include "exfat_raw.h"
#include "exfat_fs.h"
@@ -772,6 +773,7 @@ const struct file_operations exfat_file_operations = {
.fsync = exfat_file_fsync,
.splice_read = exfat_splice_read,
.splice_write = iter_file_splice_write,
+ .setlease = generic_setlease,
};
const struct inode_operations exfat_file_inode_operations = {
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 08/24] f2fs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (6 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 07/24] exfat: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-10 1:47 ` Chao Yu
2026-01-08 17:13 ` [PATCH 09/24] fat: " Jeff Layton
` (18 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to f2fs_file_operations and
f2fs_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/f2fs/dir.c | 2 ++
fs/f2fs/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 48f4f98afb0138aefabaa10608961812165e2312..be70dfb3b15203d6d92c80b4bb64fec879864988 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -8,6 +8,7 @@
#include <linux/unaligned.h>
#include <linux/fs.h>
#include <linux/f2fs_fs.h>
+#include <linux/filelock.h>
#include <linux/sched/signal.h>
#include <linux/unicode.h>
#include "f2fs.h"
@@ -1136,4 +1137,5 @@ const struct file_operations f2fs_dir_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = f2fs_compat_ioctl,
#endif
+ .setlease = generic_setlease,
};
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d7047ca6b98d8a41d69ea79bcbab3e4ae4cf30b6..cd4b1d3c90ab8114533d939e8dc129cbefc85c15 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -11,6 +11,7 @@
#include <linux/writeback.h>
#include <linux/blkdev.h>
#include <linux/falloc.h>
+#include <linux/filelock.h>
#include <linux/types.h>
#include <linux/compat.h>
#include <linux/uaccess.h>
@@ -5457,4 +5458,5 @@ const struct file_operations f2fs_file_operations = {
.splice_write = iter_file_splice_write,
.fadvise = f2fs_file_fadvise,
.fop_flags = FOP_BUFFER_RASYNC,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 09/24] fat: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (7 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 08/24] f2fs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 18:12 ` OGAWA Hirofumi
2026-01-08 17:13 ` [PATCH 10/24] gfs2: add a " Jeff Layton
` (17 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to fat_file_operations and
fat_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/fat/dir.c | 2 ++
fs/fat/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 92b091783966af6a9e6f5ead1a382a98dd92bba0..807bc8b1bc145a9f15765920670c6233f7e87e55 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/compat.h>
+#include <linux/filelock.h>
#include <linux/uaccess.h>
#include <linux/iversion.h>
#include "fat.h"
@@ -876,6 +877,7 @@ const struct file_operations fat_dir_operations = {
.compat_ioctl = fat_compat_dir_ioctl,
#endif
.fsync = fat_file_fsync,
+ .setlease = generic_setlease,
};
static int fat_get_short_entry(struct inode *dir, loff_t *pos,
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 4fc49a614fb8fd64e219db60c6d9e7dd100aea1c..d50a6d8bfaae0c75b2dbe838d108135206d0f123 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -13,6 +13,7 @@
#include <linux/mount.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
+#include <linux/filelock.h>
#include <linux/fsnotify.h>
#include <linux/security.h>
#include <linux/falloc.h>
@@ -212,6 +213,7 @@ const struct file_operations fat_file_operations = {
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
.fallocate = fat_fallocate,
+ .setlease = generic_setlease,
};
static int fat_cont_expand(struct inode *inode, loff_t size)
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 10/24] gfs2: add a setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (8 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 09/24] fat: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 11/24] jffs2: add " Jeff Layton
` (16 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
gfs2_file_fops_nolock() already has this explicitly set, so it's only
necessary to set this in gfs2_dir_fops_nolock(). A future patch
will change the default behavior to reject lease attempts with -EINVAL
when there is no setlease file operation defined.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/gfs2/file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 86376f0dbf3a553375b0064c9a1eff3bfa9651f5..6daa96d815e1e30f099938543a0ed19aa90c720c 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1639,5 +1639,6 @@ const struct file_operations gfs2_dir_fops_nolock = {
.release = gfs2_release,
.fsync = gfs2_fsync,
.llseek = default_llseek,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 11/24] jffs2: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (9 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 10/24] gfs2: add a " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-09 8:49 ` Richard Weinberger
2026-01-08 17:13 ` [PATCH 12/24] jfs: " Jeff Layton
` (15 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to jffs2_file_operations and
jffs2_dir_operations, pointing to generic_setlease. A future patch
will change the default behavior to reject lease attempts with -EINVAL
when there is no setlease file operation defined. Add generic_setlease
to retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/jffs2/dir.c | 2 ++
fs/jffs2/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index dd91f725ded69ccb3a240aafd72a4b552f21bcd9..2b38ce1fd8e8d8d59e80f6ffb9ea2935f8cb27e4 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -15,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/crc32.h>
#include <linux/jffs2.h>
#include "jffs2_fs_i.h"
@@ -48,6 +49,7 @@ const struct file_operations jffs2_dir_operations =
.unlocked_ioctl=jffs2_ioctl,
.fsync = jffs2_fsync,
.llseek = generic_file_llseek,
+ .setlease = generic_setlease,
};
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index b697f3c259ef25171ce30785d4584d5a53751a0d..5e1ef4bc009b6e5b4818a7467639fc328c137c12 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/time.h>
#include <linux/pagemap.h>
#include <linux/highmem.h>
@@ -60,6 +61,7 @@ const struct file_operations jffs2_file_operations =
.fsync = jffs2_fsync,
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
+ .setlease = generic_setlease,
};
/* jffs2_file_inode_operations */
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 12/24] jfs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (10 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 11/24] jffs2: add " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 19:46 ` Dave Kleikamp
2026-01-09 7:40 ` Richard Weinberger
2026-01-08 17:13 ` [PATCH 13/24] nilfs2: " Jeff Layton
` (14 subsequent siblings)
26 siblings, 2 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to jfs_file_operations and
jfs_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/jfs/file.c | 2 ++
fs/jfs/namei.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 87ad042221e78959200cce12a59a3ffd6d06c0d7..246568cb9a6ec144831eb3592712cce323d8cf1d 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -6,6 +6,7 @@
#include <linux/mm.h>
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/posix_acl.h>
#include <linux/quotaops.h>
#include "jfs_incore.h"
@@ -153,4 +154,5 @@ const struct file_operations jfs_file_operations = {
.release = jfs_release,
.unlocked_ioctl = jfs_ioctl,
.compat_ioctl = compat_ptr_ioctl,
+ .setlease = generic_setlease,
};
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 65a218eba8faf9508f5727515b812f6de2661618..f7e2ae7a4c37ed87675f0ccb3276b37e6ce08cb4 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -5,6 +5,7 @@
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/namei.h>
#include <linux/ctype.h>
#include <linux/quotaops.h>
@@ -1545,6 +1546,7 @@ const struct file_operations jfs_dir_operations = {
.unlocked_ioctl = jfs_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.llseek = generic_file_llseek,
+ .setlease = generic_setlease,
};
static int jfs_ci_hash(const struct dentry *dir, struct qstr *this)
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 13/24] nilfs2: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (11 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 12/24] jfs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-09 5:26 ` Ryusuke Konishi
2026-01-08 17:13 ` [PATCH 14/24] ntfs3: " Jeff Layton
` (13 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to nilfs_file_operations and
nilfs_dir_operations, pointing to generic_setlease. A future patch
will change the default behavior to reject lease attempts with -EINVAL
when there is no setlease file operation defined. Add generic_setlease
to retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nilfs2/dir.c | 3 ++-
fs/nilfs2/file.c | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 6ca3d74be1e16d5bc577e2520f1e841287a2511f..b243199036dfa1ab2299efaaa5bdf5da2d159ff2 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -30,6 +30,7 @@
*/
#include <linux/pagemap.h>
+#include <linux/filelock.h>
#include "nilfs.h"
#include "page.h"
@@ -661,5 +662,5 @@ const struct file_operations nilfs_dir_operations = {
.compat_ioctl = nilfs_compat_ioctl,
#endif /* CONFIG_COMPAT */
.fsync = nilfs_sync_file,
-
+ .setlease = generic_setlease,
};
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index 1b8d754db44d44d25dcd13f008d266ec83c74d3f..f93b68c4877c5ed369e90b723517e117142335de 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -8,6 +8,7 @@
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/mm.h>
#include <linux/writeback.h>
#include "nilfs.h"
@@ -150,6 +151,7 @@ const struct file_operations nilfs_file_operations = {
.fsync = nilfs_sync_file,
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
+ .setlease = generic_setlease,
};
const struct inode_operations nilfs_file_inode_operations = {
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 14/24] ntfs3: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (12 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 13/24] nilfs2: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 15/24] ocfs2: " Jeff Layton
` (12 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to ntfs_file_operations,
ntfs_legacy_file_operations, ntfs_dir_operations, and
ntfs_legacy_dir_operations, pointing to generic_setlease. A future
patch will change the default behavior to reject lease attempts with
-EINVAL when there is no setlease file operation defined. Add
generic_setlease to retain the ability to set leases on this
filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ntfs3/dir.c | 3 +++
fs/ntfs3/file.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index b98e95d6b4d993db114283a0f38cf10b1a7520a9..b66438e34bbb84483c5e6a5dde437251339d4335 100644
--- a/fs/ntfs3/dir.c
+++ b/fs/ntfs3/dir.c
@@ -8,6 +8,7 @@
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/nls.h>
#include "debug.h"
@@ -630,6 +631,7 @@ const struct file_operations ntfs_dir_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = ntfs_compat_ioctl,
#endif
+ .setlease = generic_setlease,
};
#if IS_ENABLED(CONFIG_NTFS_FS)
@@ -638,6 +640,7 @@ const struct file_operations ntfs_legacy_dir_operations = {
.read = generic_read_dir,
.iterate_shared = ntfs_readdir,
.open = ntfs_file_open,
+ .setlease = generic_setlease,
};
#endif
// clang-format on
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 2e7b2e566ebe18c173319c7cfd4304c22ddd2f28..6cb4479072a66dc9c3429be1c4bcebce176e5913 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -14,6 +14,7 @@
#include <linux/falloc.h>
#include <linux/fiemap.h>
#include <linux/fileattr.h>
+#include <linux/filelock.h>
#include "debug.h"
#include "ntfs.h"
@@ -1477,6 +1478,7 @@ const struct file_operations ntfs_file_operations = {
.fsync = ntfs_file_fsync,
.fallocate = ntfs_fallocate,
.release = ntfs_file_release,
+ .setlease = generic_setlease,
};
#if IS_ENABLED(CONFIG_NTFS_FS)
@@ -1486,6 +1488,7 @@ const struct file_operations ntfs_legacy_file_operations = {
.splice_read = ntfs_file_splice_read,
.open = ntfs_file_open,
.release = ntfs_file_release,
+ .setlease = generic_setlease,
};
#endif
// clang-format on
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 15/24] ocfs2: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (13 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 14/24] ntfs3: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:29 ` Jan Kara
2026-01-08 17:13 ` [PATCH 16/24] orangefs: " Jeff Layton
` (11 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to ocfs2_fops, ocfs2_dops,
ocfs2_fops_no_plocks, and ocfs2_dops_no_plocks, pointing to
generic_setlease. A future patch will change the default behavior to
reject lease attempts with -EINVAL when there is no setlease file
operation defined. Add generic_setlease to retain the ability to set
leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ocfs2/file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 732c61599159ccb1f8fbcbb44e848f78678221d9..ed961a854983d5e7abe935e160e3029c48e6fca4 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -19,6 +19,7 @@
#include <linux/mount.h>
#include <linux/writeback.h>
#include <linux/falloc.h>
+#include <linux/filelock.h>
#include <linux/quotaops.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
@@ -2823,6 +2824,7 @@ const struct file_operations ocfs2_fops = {
.fallocate = ocfs2_fallocate,
.remap_file_range = ocfs2_remap_file_range,
.fop_flags = FOP_ASYNC_LOCK,
+ .setlease = generic_setlease,
};
WRAP_DIR_ITER(ocfs2_readdir) // FIXME!
@@ -2840,6 +2842,7 @@ const struct file_operations ocfs2_dops = {
.lock = ocfs2_lock,
.flock = ocfs2_flock,
.fop_flags = FOP_ASYNC_LOCK,
+ .setlease = generic_setlease,
};
/*
@@ -2871,6 +2874,7 @@ const struct file_operations ocfs2_fops_no_plocks = {
.splice_write = iter_file_splice_write,
.fallocate = ocfs2_fallocate,
.remap_file_range = ocfs2_remap_file_range,
+ .setlease = generic_setlease,
};
const struct file_operations ocfs2_dops_no_plocks = {
@@ -2885,4 +2889,5 @@ const struct file_operations ocfs2_dops_no_plocks = {
.compat_ioctl = ocfs2_compat_ioctl,
#endif
.flock = ocfs2_flock,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 16/24] orangefs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (14 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 15/24] ocfs2: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 17/24] overlayfs: " Jeff Layton
` (10 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to orangefs_file_operations and
orangefs_dir_operations, pointing to generic_setlease. A future patch
will change the default behavior to reject lease attempts with -EINVAL
when there is no setlease file operation defined. Add generic_setlease
to retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/orangefs/dir.c | 4 +++-
fs/orangefs/file.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/orangefs/dir.c b/fs/orangefs/dir.c
index 6d1fbeca9d8172a2155f5b524cd19bc896748d64..3c32bf9f1296e5eb62a7a603faaf4a5493c57166 100644
--- a/fs/orangefs/dir.c
+++ b/fs/orangefs/dir.c
@@ -3,6 +3,7 @@
* Copyright 2017 Omnibond Systems, L.L.C.
*/
+#include <linux/filelock.h>
#include "protocol.h"
#include "orangefs-kernel.h"
#include "orangefs-bufmap.h"
@@ -392,5 +393,6 @@ const struct file_operations orangefs_dir_operations = {
.read = generic_read_dir,
.iterate_shared = orangefs_dir_iterate,
.open = orangefs_dir_open,
- .release = orangefs_dir_release
+ .release = orangefs_dir_release,
+ .setlease = generic_setlease,
};
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 919f99b16834160dd8cc87faf9b8802aa02796cf..afd610a3fc68855eba1c892d91a5c0686876cfc3 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -583,4 +583,5 @@ const struct file_operations orangefs_file_operations = {
.flush = orangefs_flush,
.release = orangefs_file_release,
.fsync = orangefs_fsync,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 17/24] overlayfs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (15 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 16/24] orangefs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 18/24] squashfs: " Jeff Layton
` (9 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation to ovl_file_operations and
ovl_dir_operations, pointing to generic_setlease. A future patch will
change the default behavior to reject lease attempts with -EINVAL when
there is no setlease file operation defined. Add generic_setlease to
retain the ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/overlayfs/file.c | 2 ++
fs/overlayfs/readdir.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index cbae894572348acb3ba6c2b6e7f84558379110c2..8269431ba3c66d49d2eea24c4ca63a3d2879580a 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -5,6 +5,7 @@
#include <linux/cred.h>
#include <linux/file.h>
+#include <linux/filelock.h>
#include <linux/mount.h>
#include <linux/xattr.h>
#include <linux/uio.h>
@@ -647,4 +648,5 @@ const struct file_operations ovl_file_operations = {
.copy_file_range = ovl_copy_file_range,
.remap_file_range = ovl_remap_file_range,
+ .setlease = generic_setlease,
};
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 160960bb0ad0b0cd219cb2d8e82d8bda08885af0..7fd415d7471ed58849710da9f8a414b2b7aca1b4 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -8,6 +8,7 @@
#include <linux/slab.h>
#include <linux/namei.h>
#include <linux/file.h>
+#include <linux/filelock.h>
#include <linux/xattr.h>
#include <linux/rbtree.h>
#include <linux/security.h>
@@ -1070,6 +1071,7 @@ const struct file_operations ovl_dir_operations = {
.llseek = ovl_dir_llseek,
.fsync = ovl_dir_fsync,
.release = ovl_dir_release,
+ .setlease = generic_setlease,
};
int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list)
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 18/24] squashfs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (16 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 17/24] overlayfs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 19/24] tmpfs: " Jeff Layton
` (8 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation pointing to generic_setlease to the
squashfs file_operations structures. A future patch will change the
default behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/squashfs/dir.c | 2 ++
fs/squashfs/file.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c
index a2ade63eccdf38cd7829a1e79efbb6cb607fa54f..cd3598bd034f01c74eb2e840187e14cb05b640f3 100644
--- a/fs/squashfs/dir.c
+++ b/fs/squashfs/dir.c
@@ -15,6 +15,7 @@
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/vfs.h>
#include <linux/slab.h>
@@ -220,4 +221,5 @@ const struct file_operations squashfs_dir_ops = {
.read = generic_read_dir,
.iterate_shared = squashfs_readdir,
.llseek = generic_file_llseek,
+ .setlease = generic_setlease,
};
diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index 1582e0637a7ec87c02afee845dce052259e6af1b..4be92206e755dc6b385bc9de456449c5ed4385b7 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -28,6 +28,7 @@
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/vfs.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -775,5 +776,6 @@ const struct file_operations squashfs_file_operations = {
.llseek = squashfs_llseek,
.read_iter = generic_file_read_iter,
.mmap_prepare = generic_file_readonly_mmap_prepare,
- .splice_read = filemap_splice_read
+ .splice_read = filemap_splice_read,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 19/24] tmpfs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (17 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 18/24] squashfs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:31 ` Jan Kara
2026-01-08 17:13 ` [PATCH 20/24] udf: " Jeff Layton
` (7 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation pointing to generic_setlease to the
tmpfs file_operations structures. A future patch will change the
default behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/libfs.c | 2 ++
mm/shmem.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/libfs.c b/fs/libfs.c
index 591eb649ebbacf202ff48cd3abd64a175daa291c..697c6d5fc12786c036f0086886297fb5cd52ae00 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -6,6 +6,7 @@
#include <linux/blkdev.h>
#include <linux/export.h>
+#include <linux/filelock.h>
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/cred.h>
@@ -570,6 +571,7 @@ const struct file_operations simple_offset_dir_operations = {
.iterate_shared = offset_readdir,
.read = generic_read_dir,
.fsync = noop_fsync,
+ .setlease = generic_setlease,
};
struct dentry *find_next_child(struct dentry *parent, struct dentry *prev)
diff --git a/mm/shmem.c b/mm/shmem.c
index ec6c01378e9d2bd47db9d7506e4d6a565e092185..88ef1fd5cd38efedbb31353da2871ab1d47e68a5 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -29,6 +29,7 @@
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/fileattr.h>
+#include <linux/filelock.h>
#include <linux/mm.h>
#include <linux/random.h>
#include <linux/sched/signal.h>
@@ -5219,6 +5220,7 @@ static const struct file_operations shmem_file_operations = {
.splice_read = shmem_file_splice_read,
.splice_write = iter_file_splice_write,
.fallocate = shmem_fallocate,
+ .setlease = generic_setlease,
#endif
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 20/24] udf: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (18 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 19/24] tmpfs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:29 ` Jan Kara
2026-01-08 17:13 ` [PATCH 21/24] ufs: " Jeff Layton
` (6 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation pointing to generic_setlease to the udf
file_operations structures. A future patch will change the default
behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/udf/dir.c | 2 ++
fs/udf/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 5023dfe191e8088b78396997a8915bf383f7a2d2..5bf75638f3520ecb3a0a2ade2279ab56787ecd11 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -24,6 +24,7 @@
#include <linux/string.h>
#include <linux/errno.h>
+#include <linux/filelock.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/bio.h>
@@ -157,4 +158,5 @@ const struct file_operations udf_dir_operations = {
.iterate_shared = udf_readdir,
.unlocked_ioctl = udf_ioctl,
.fsync = generic_file_fsync,
+ .setlease = generic_setlease,
};
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 0d76c4f37b3e71ffe6a883a8d97a6c3038d2a01d..32ae7cfd72c549958b70824b449cf146f6750f44 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -28,6 +28,7 @@
#include <linux/string.h> /* memset */
#include <linux/capability.h>
#include <linux/errno.h>
+#include <linux/filelock.h>
#include <linux/pagemap.h>
#include <linux/uio.h>
@@ -208,6 +209,7 @@ const struct file_operations udf_file_operations = {
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
.llseek = generic_file_llseek,
+ .setlease = generic_setlease,
};
static int udf_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 21/24] ufs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (19 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 20/24] udf: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 22/24] xfs: " Jeff Layton
` (5 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation pointing to generic_setlease to the ufs
file_operations structures. A future patch will change the default
behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ufs/dir.c | 2 ++
fs/ufs/file.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 0388a1bae326ba41bc03471fcb7ed01098a707d8..43f1578ab8666a9611d4a77f5aababfce812fbe4 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -19,6 +19,7 @@
#include <linux/time.h>
#include <linux/fs.h>
+#include <linux/filelock.h>
#include <linux/swap.h>
#include <linux/iversion.h>
@@ -653,4 +654,5 @@ const struct file_operations ufs_dir_operations = {
.iterate_shared = ufs_readdir,
.fsync = generic_file_fsync,
.llseek = ufs_dir_llseek,
+ .setlease = generic_setlease,
};
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index c2a391c17df7f34d9961973909d1985f5f786e92..809c7a4603f863025caa947b2e08f0c2922ad619 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -25,6 +25,7 @@
*/
#include <linux/fs.h>
+#include <linux/filelock.h>
#include "ufs_fs.h"
#include "ufs.h"
@@ -43,4 +44,5 @@ const struct file_operations ufs_file_operations = {
.fsync = generic_file_fsync,
.splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 22/24] xfs: add setlease file operation
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (20 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 21/24] ufs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:13 ` [PATCH 23/24] filelock: default to returning -EINVAL when ->setlease operation is NULL Jeff Layton
` (4 subsequent siblings)
26 siblings, 0 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Add the setlease file_operation pointing to generic_setlease to the xfs
file_operations structures. A future patch will change the default
behavior to reject lease attempts with -EINVAL when there is no
setlease file operation defined. Add generic_setlease to retain the
ability to set leases on this filesystem.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/xfs/xfs_file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 7874cf745af372fe8d90af09c6916d4c635472e0..ecd7bf42446b38e075986d1c774dea4e8c0c0d01 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -36,6 +36,7 @@
#include <linux/mman.h>
#include <linux/fadvise.h>
#include <linux/mount.h>
+#include <linux/filelock.h>
static const struct vm_operations_struct xfs_file_vm_ops;
@@ -2007,6 +2008,7 @@ const struct file_operations xfs_file_operations = {
.fop_flags = FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE |
FOP_DONTCACHE,
+ .setlease = generic_setlease,
};
const struct file_operations xfs_dir_file_operations = {
@@ -2019,4 +2021,5 @@ const struct file_operations xfs_dir_file_operations = {
.compat_ioctl = xfs_file_compat_ioctl,
#endif
.fsync = xfs_dir_fsync,
+ .setlease = generic_setlease,
};
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 23/24] filelock: default to returning -EINVAL when ->setlease operation is NULL
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (21 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 22/24] xfs: " Jeff Layton
@ 2026-01-08 17:13 ` Jeff Layton
2026-01-08 17:34 ` Jan Kara
2026-01-08 17:13 ` [PATCH 24/24] fs: remove simple_nosetlease() Jeff Layton
` (3 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Now that most filesystems where we expect to need lease support have
their ->setlease() operations explicitly set, change kernel_setlease()
to return -EINVAL when the setlease is a NULL pointer.
Also update the Documentation/ with info about this change.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
Documentation/filesystems/porting.rst | 9 +++++++++
Documentation/filesystems/vfs.rst | 9 ++++++---
fs/locks.c | 3 +--
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst
index 3397937ed838e5e7dfacc6379a9d71481cc30914..c0f7103628ab5ed70d142a5c7f6d95ca4734c741 100644
--- a/Documentation/filesystems/porting.rst
+++ b/Documentation/filesystems/porting.rst
@@ -1334,3 +1334,12 @@ end_creating() and the parent will be unlocked precisely when necessary.
kill_litter_super() is gone; convert to DCACHE_PERSISTENT use (as all
in-tree filesystems have done).
+
+---
+
+**mandatory**
+
+The ->setlease() file_operation must now be explicitly set in order to provide
+support for leases. When set to NULL, the kernel will now return -EINVAL to
+attempts to set a lease. Filesystems that wish to use the kernel-internal lease
+implementation should set it to generic_setlease().
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index 670ba66b60e4964927164a57e68adc0edfc681ee..21dc8921dd9ebedeafc4c108de7327f172138b6e 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -1180,9 +1180,12 @@ otherwise noted.
method is used by the splice(2) system call
``setlease``
- called by the VFS to set or release a file lock lease. setlease
- implementations should call generic_setlease to record or remove
- the lease in the inode after setting it.
+ called by the VFS to set or release a file lock lease. Local
+ filesystems that wish to use the kernel-internal lease implementation
+ should set this to generic_setlease(). Other setlease implementations
+ should call generic_setlease() to record or remove the lease in the inode
+ after setting it. When set to NULL, attempts to set or remove a lease will
+ return -EINVAL.
``fallocate``
called by the VFS to preallocate blocks or punch a hole.
diff --git a/fs/locks.c b/fs/locks.c
index e2036aa4bd3734be415296f9157d8f17166878aa..ea38a18f373c2202ba79e8e37125f8d32a0e2d42 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2016,8 +2016,7 @@ kernel_setlease(struct file *filp, int arg, struct file_lease **lease, void **pr
setlease_notifier(arg, *lease);
if (filp->f_op->setlease)
return filp->f_op->setlease(filp, arg, lease, priv);
- else
- return generic_setlease(filp, arg, lease, priv);
+ return -EINVAL;
}
EXPORT_SYMBOL_GPL(kernel_setlease);
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 24/24] fs: remove simple_nosetlease()
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (22 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 23/24] filelock: default to returning -EINVAL when ->setlease operation is NULL Jeff Layton
@ 2026-01-08 17:13 ` 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
` (2 subsequent siblings)
26 siblings, 1 reply; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 17:13 UTC (permalink / raw)
To: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical, Jeff Layton
Setting ->setlease() to a NULL pointer now has the same effect as
setting it to simple_nosetlease(). Remove all of the setlease
file_operations that are set to simple_nosetlease, and the function
itself.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/9p/vfs_dir.c | 2 --
fs/9p/vfs_file.c | 2 --
fs/ceph/dir.c | 2 --
fs/ceph/file.c | 1 -
fs/fuse/dir.c | 1 -
fs/gfs2/file.c | 2 --
fs/libfs.c | 18 ------------------
fs/nfs/dir.c | 1 -
fs/nfs/file.c | 1 -
fs/smb/client/cifsfs.c | 1 -
fs/vboxsf/dir.c | 1 -
fs/vboxsf/file.c | 1 -
include/linux/fs.h | 1 -
13 files changed, 34 deletions(-)
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index af7f72abbb76aaff934b80d4002f32e3b0d17b6d..e0d34e4e9076e3b1a6c5ed07a3e009a50c9fa2a9 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -242,7 +242,6 @@ const struct file_operations v9fs_dir_operations = {
.iterate_shared = v9fs_dir_readdir,
.open = v9fs_file_open,
.release = v9fs_dir_release,
- .setlease = simple_nosetlease,
};
const struct file_operations v9fs_dir_operations_dotl = {
@@ -252,5 +251,4 @@ const struct file_operations v9fs_dir_operations_dotl = {
.open = v9fs_file_open,
.release = v9fs_dir_release,
.fsync = v9fs_file_fsync_dotl,
- .setlease = simple_nosetlease,
};
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 6f3880208587e39d965dcd4b4280a2079a36b4a2..c5e73c37baea55394294b939fdda7170db8503c0 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -517,7 +517,6 @@ const struct file_operations v9fs_file_operations = {
.splice_read = v9fs_file_splice_read,
.splice_write = iter_file_splice_write,
.fsync = v9fs_file_fsync,
- .setlease = simple_nosetlease,
};
const struct file_operations v9fs_file_operations_dotl = {
@@ -532,5 +531,4 @@ const struct file_operations v9fs_file_operations_dotl = {
.splice_read = v9fs_file_splice_read,
.splice_write = iter_file_splice_write,
.fsync = v9fs_file_fsync_dotl,
- .setlease = simple_nosetlease,
};
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 804588524cd570078ba59bf38d2460950ca67daf..86d7aa594ea99335af3e91a95c0a418fdc1b8a8a 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -2214,7 +2214,6 @@ const struct file_operations ceph_dir_fops = {
.fsync = ceph_fsync,
.lock = ceph_lock,
.flock = ceph_flock,
- .setlease = simple_nosetlease,
};
const struct file_operations ceph_snapdir_fops = {
@@ -2222,7 +2221,6 @@ const struct file_operations ceph_snapdir_fops = {
.llseek = ceph_dir_llseek,
.open = ceph_open,
.release = ceph_release,
- .setlease = simple_nosetlease,
};
const struct inode_operations ceph_dir_iops = {
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 983390069f737254e8c7bcad1718f375499f443e..31b691b2aea21f04c6d6c9aacbfd664c13a3ef64 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -3169,7 +3169,6 @@ const struct file_operations ceph_file_fops = {
.mmap_prepare = ceph_mmap_prepare,
.fsync = ceph_fsync,
.lock = ceph_lock,
- .setlease = simple_nosetlease,
.flock = ceph_flock,
.splice_read = ceph_splice_read,
.splice_write = iter_file_splice_write,
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 4b6b3d2758ff225dc389016017753b09fadff9d1..d6ee2d38fc2dad5c0995b62dd589e7a46d18424d 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -2421,7 +2421,6 @@ static const struct file_operations fuse_dir_operations = {
.fsync = fuse_dir_fsync,
.unlocked_ioctl = fuse_dir_ioctl,
.compat_ioctl = fuse_dir_compat_ioctl,
- .setlease = simple_nosetlease,
};
static const struct inode_operations fuse_common_inode_operations = {
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 6daa96d815e1e30f099938543a0ed19aa90c720c..3e061e8115ece08c7cb6594b8adb653ccec998ed 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1593,7 +1593,6 @@ const struct file_operations gfs2_file_fops = {
.flock = gfs2_flock,
.splice_read = copy_splice_read,
.splice_write = gfs2_file_splice_write,
- .setlease = simple_nosetlease,
.fallocate = gfs2_fallocate,
.fop_flags = FOP_ASYNC_LOCK,
};
@@ -1608,7 +1607,6 @@ const struct file_operations gfs2_dir_fops = {
.lock = gfs2_lock,
.flock = gfs2_flock,
.llseek = default_llseek,
- .setlease = simple_nosetlease,
.fop_flags = FOP_ASYNC_LOCK,
};
diff --git a/fs/libfs.c b/fs/libfs.c
index 697c6d5fc12786c036f0086886297fb5cd52ae00..f1860dff86f2703266beecf31e9d2667af7a9684 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1699,24 +1699,6 @@ struct inode *alloc_anon_inode(struct super_block *s)
}
EXPORT_SYMBOL(alloc_anon_inode);
-/**
- * simple_nosetlease - generic helper for prohibiting leases
- * @filp: file pointer
- * @arg: type of lease to obtain
- * @flp: new lease supplied for insertion
- * @priv: private data for lm_setup operation
- *
- * Generic helper for filesystems that do not wish to allow leases to be set.
- * All arguments are ignored and it just returns -EINVAL.
- */
-int
-simple_nosetlease(struct file *filp, int arg, struct file_lease **flp,
- void **priv)
-{
- return -EINVAL;
-}
-EXPORT_SYMBOL(simple_nosetlease);
-
/**
* simple_get_link - generic helper to get the target of "fast" symlinks
* @dentry: not used here
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 71df279febf797880ded19e45528c3df4cea2dde..23a78a742b619dea8b76ddf28f4f59a1c8a015e2 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -66,7 +66,6 @@ const struct file_operations nfs_dir_operations = {
.open = nfs_opendir,
.release = nfs_closedir,
.fsync = nfs_fsync_dir,
- .setlease = simple_nosetlease,
};
const struct address_space_operations nfs_dir_aops = {
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index d020aab40c64ebda30d130b6acee1b9194621457..9d269561961825f88529551b0f0287920960ac62 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -962,7 +962,6 @@ const struct file_operations nfs_file_operations = {
.splice_read = nfs_file_splice_read,
.splice_write = iter_file_splice_write,
.check_flags = nfs_check_flags,
- .setlease = simple_nosetlease,
.fop_flags = FOP_DONTCACHE,
};
EXPORT_SYMBOL_GPL(nfs_file_operations);
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index a3dc7cb1ab541d35c2e43eefb7a2d2d23ad88bb3..8015df1f711e150a0afb44875899435303d9d406 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1709,7 +1709,6 @@ const struct file_operations cifs_dir_ops = {
.remap_file_range = cifs_remap_file_range,
.llseek = generic_file_llseek,
.fsync = cifs_dir_fsync,
- .setlease = simple_nosetlease,
};
static void
diff --git a/fs/vboxsf/dir.c b/fs/vboxsf/dir.c
index 230d7589d15cc98f6bc7e930ba40ca5f7dbf7e18..42bedc4ec7af7709c564a7174805d185ce86f854 100644
--- a/fs/vboxsf/dir.c
+++ b/fs/vboxsf/dir.c
@@ -186,7 +186,6 @@ const struct file_operations vboxsf_dir_fops = {
.release = vboxsf_dir_release,
.read = generic_read_dir,
.llseek = generic_file_llseek,
- .setlease = simple_nosetlease,
};
/*
diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c
index 4bebd947314a796365728b3af1c46b0d7070abc1..111752010edb2ba48ee1fdf0e3729369c6521ee8 100644
--- a/fs/vboxsf/file.c
+++ b/fs/vboxsf/file.c
@@ -218,7 +218,6 @@ const struct file_operations vboxsf_reg_fops = {
.release = vboxsf_file_release,
.fsync = noop_fsync,
.splice_read = filemap_splice_read,
- .setlease = simple_nosetlease,
};
const struct inode_operations vboxsf_reg_iops = {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f5c9cf28c4dcf9ec648f0fc4f3f4bb44d1b1c482..e46e8aad9339357f99c40eede8ca7b6b727284fe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3217,7 +3217,6 @@ extern int always_delete_dentry(const struct dentry *);
extern struct inode *alloc_anon_inode(struct super_block *);
struct inode *anon_inode_make_secure_inode(struct super_block *sb, const char *name,
const struct inode *context_inode);
-extern int simple_nosetlease(struct file *, int, struct file_lease **, void **);
extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
--
2.52.0
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 01/24] fs: add setlease to generic_ro_fops and read-only filesystem directory operations
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
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:26 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:12:56, Jeff Layton wrote:
> Add the setlease file_operation to generic_ro_fops, which covers file
> operations for several read-only filesystems (BEFS, EFS, ISOFS, QNX4,
> QNX6, CRAMFS, FREEVXFS). Also add setlease to the directory
> file_operations for these filesystems. A future patch will change the
> default behavior to reject lease attempts with -EINVAL when there is no
> setlease file operation defined. Add generic_setlease to retain the
> ability to set leases on these filesystems.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/befs/linuxvfs.c | 2 ++
> fs/cramfs/inode.c | 2 ++
> fs/efs/dir.c | 2 ++
> fs/freevxfs/vxfs_lookup.c | 2 ++
> fs/isofs/dir.c | 2 ++
> fs/qnx4/dir.c | 2 ++
> fs/qnx6/dir.c | 2 ++
> fs/read_write.c | 2 ++
> 8 files changed, 16 insertions(+)
>
> diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
> index 9fcfdd6b8189aaf5cc3b68aa8dff4798af5bdcbc..d7c5d9270387bf6c3e94942e6331b449f90fe428 100644
> --- a/fs/befs/linuxvfs.c
> +++ b/fs/befs/linuxvfs.c
> @@ -14,6 +14,7 @@
> #include <linux/fs_context.h>
> #include <linux/fs_parser.h>
> #include <linux/errno.h>
> +#include <linux/filelock.h>
> #include <linux/stat.h>
> #include <linux/nls.h>
> #include <linux/buffer_head.h>
> @@ -79,6 +80,7 @@ static const struct file_operations befs_dir_operations = {
> .read = generic_read_dir,
> .iterate_shared = befs_readdir,
> .llseek = generic_file_llseek,
> + .setlease = generic_setlease,
> };
>
> static const struct inode_operations befs_dir_inode_operations = {
> diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
> index e54ebe402df79d43a2c7cf491d669829f7ef81b7..41b1a869cf135d014003d6bf1c343d590ae7a084 100644
> --- a/fs/cramfs/inode.c
> +++ b/fs/cramfs/inode.c
> @@ -16,6 +16,7 @@
> #include <linux/module.h>
> #include <linux/fs.h>
> #include <linux/file.h>
> +#include <linux/filelock.h>
> #include <linux/pagemap.h>
> #include <linux/ramfs.h>
> #include <linux/init.h>
> @@ -938,6 +939,7 @@ static const struct file_operations cramfs_directory_operations = {
> .llseek = generic_file_llseek,
> .read = generic_read_dir,
> .iterate_shared = cramfs_readdir,
> + .setlease = generic_setlease,
> };
>
> static const struct inode_operations cramfs_dir_inode_operations = {
> diff --git a/fs/efs/dir.c b/fs/efs/dir.c
> index f892ac7c2a35e0094a314eeded06a974154e46d7..35ad0092c11547af68ef8baf4965b50a0a7593fe 100644
> --- a/fs/efs/dir.c
> +++ b/fs/efs/dir.c
> @@ -6,6 +6,7 @@
> */
>
> #include <linux/buffer_head.h>
> +#include <linux/filelock.h>
> #include "efs.h"
>
> static int efs_readdir(struct file *, struct dir_context *);
> @@ -14,6 +15,7 @@ const struct file_operations efs_dir_operations = {
> .llseek = generic_file_llseek,
> .read = generic_read_dir,
> .iterate_shared = efs_readdir,
> + .setlease = generic_setlease,
> };
>
> const struct inode_operations efs_dir_inode_operations = {
> diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
> index 1b0bca8b4cc686043d92246042dcf833d37712e4..138e08de976ea762a46043316f27e9a031f60c32 100644
> --- a/fs/freevxfs/vxfs_lookup.c
> +++ b/fs/freevxfs/vxfs_lookup.c
> @@ -8,6 +8,7 @@
> * Veritas filesystem driver - lookup and other directory related code.
> */
> #include <linux/fs.h>
> +#include <linux/filelock.h>
> #include <linux/time.h>
> #include <linux/mm.h>
> #include <linux/highmem.h>
> @@ -36,6 +37,7 @@ const struct file_operations vxfs_dir_operations = {
> .llseek = generic_file_llseek,
> .read = generic_read_dir,
> .iterate_shared = vxfs_readdir,
> + .setlease = generic_setlease,
> };
>
>
> diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
> index 09df40b612fbf27a1a93af2b4fbf6a607f4a1ab4..2ca16c3fe5ef3427e5bbd0631eb8323ef3c58bf1 100644
> --- a/fs/isofs/dir.c
> +++ b/fs/isofs/dir.c
> @@ -12,6 +12,7 @@
> * isofs directory handling functions
> */
> #include <linux/gfp.h>
> +#include <linux/filelock.h>
> #include "isofs.h"
>
> int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode)
> @@ -271,6 +272,7 @@ const struct file_operations isofs_dir_operations =
> .llseek = generic_file_llseek,
> .read = generic_read_dir,
> .iterate_shared = isofs_readdir,
> + .setlease = generic_setlease,
> };
>
> /*
> diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
> index 42a529e26bd68b6de1a7738c409d5942a92066f8..6402715ab377e5686558371dd76e5a4c1cfbb787 100644
> --- a/fs/qnx4/dir.c
> +++ b/fs/qnx4/dir.c
> @@ -13,6 +13,7 @@
> */
>
> #include <linux/buffer_head.h>
> +#include <linux/filelock.h>
> #include "qnx4.h"
>
> static int qnx4_readdir(struct file *file, struct dir_context *ctx)
> @@ -71,6 +72,7 @@ const struct file_operations qnx4_dir_operations =
> .read = generic_read_dir,
> .iterate_shared = qnx4_readdir,
> .fsync = generic_file_fsync,
> + .setlease = generic_setlease,
> };
>
> const struct inode_operations qnx4_dir_inode_operations =
> diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c
> index b4d10e45f2e41b45568fe813a3cc0aa253bcab6e..ae0c9846833d916beb7f356cfa6e9de01a6f6963 100644
> --- a/fs/qnx6/dir.c
> +++ b/fs/qnx6/dir.c
> @@ -11,6 +11,7 @@
> *
> */
>
> +#include <linux/filelock.h>
> #include "qnx6.h"
>
> static unsigned qnx6_lfile_checksum(char *name, unsigned size)
> @@ -275,6 +276,7 @@ const struct file_operations qnx6_dir_operations = {
> .read = generic_read_dir,
> .iterate_shared = qnx6_readdir,
> .fsync = generic_file_fsync,
> + .setlease = generic_setlease,
> };
>
> const struct inode_operations qnx6_dir_inode_operations = {
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 833bae068770a4e410e4895132586313a9687fa2..50bff7edc91f36fe5ee24198bd51a33c278d40a2 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -20,6 +20,7 @@
> #include <linux/compat.h>
> #include <linux/mount.h>
> #include <linux/fs.h>
> +#include <linux/filelock.h>
> #include "internal.h"
>
> #include <linux/uaccess.h>
> @@ -30,6 +31,7 @@ const struct file_operations generic_ro_fops = {
> .read_iter = generic_file_read_iter,
> .mmap_prepare = generic_file_readonly_mmap_prepare,
> .splice_read = filemap_splice_read,
> + .setlease = generic_setlease,
> };
>
> EXPORT_SYMBOL(generic_ro_fops);
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 05/24] ext2: add setlease file operation
2026-01-08 17:13 ` [PATCH 05/24] ext2: " Jeff Layton
@ 2026-01-08 17:28 ` Jan Kara
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:28 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:00, Jeff Layton wrote:
> Add the setlease file_operation to ext2_file_operations and
> ext2_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext2/dir.c | 2 ++
> fs/ext2/file.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
> index b07b3b369710c4848d6091742cdd0b5c42d4674d..395fc36c089b7bb6360a8326727bd5606c7e2476 100644
> --- a/fs/ext2/dir.c
> +++ b/fs/ext2/dir.c
> @@ -24,6 +24,7 @@
>
> #include "ext2.h"
> #include <linux/buffer_head.h>
> +#include <linux/filelock.h>
> #include <linux/pagemap.h>
> #include <linux/swap.h>
> #include <linux/iversion.h>
> @@ -734,4 +735,5 @@ const struct file_operations ext2_dir_operations = {
> .compat_ioctl = ext2_compat_ioctl,
> #endif
> .fsync = ext2_fsync,
> + .setlease = generic_setlease,
> };
> diff --git a/fs/ext2/file.c b/fs/ext2/file.c
> index 76bddce462fced77b24d64416cb9fdb172d8270b..ebe356a38b185e0d8662f704ad20e42fe618284e 100644
> --- a/fs/ext2/file.c
> +++ b/fs/ext2/file.c
> @@ -22,6 +22,7 @@
> #include <linux/time.h>
> #include <linux/pagemap.h>
> #include <linux/dax.h>
> +#include <linux/filelock.h>
> #include <linux/quotaops.h>
> #include <linux/iomap.h>
> #include <linux/uio.h>
> @@ -325,6 +326,7 @@ const struct file_operations ext2_file_operations = {
> .get_unmapped_area = thp_get_unmapped_area,
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> + .setlease = generic_setlease,
> };
>
> const struct inode_operations ext2_file_inode_operations = {
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 06/24] ext4: add setlease file operation
2026-01-08 17:13 ` [PATCH 06/24] ext4: " Jeff Layton
@ 2026-01-08 17:28 ` Jan Kara
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:28 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:01, Jeff Layton wrote:
> Add the setlease file_operation to ext4_file_operations and
> ext4_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/dir.c | 2 ++
> fs/ext4/file.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
> index 256fe2c1d4c1619eb2cd915d8b6b05bce72656e7..00c4b3c82b6534790962dc3964c0c557162b6dff 100644
> --- a/fs/ext4/dir.c
> +++ b/fs/ext4/dir.c
> @@ -24,6 +24,7 @@
>
> #include <linux/fs.h>
> #include <linux/buffer_head.h>
> +#include <linux/filelock.h>
> #include <linux/slab.h>
> #include <linux/iversion.h>
> #include <linux/unicode.h>
> @@ -690,4 +691,5 @@ const struct file_operations ext4_dir_operations = {
> #endif
> .fsync = ext4_sync_file,
> .release = ext4_release_dir,
> + .setlease = generic_setlease,
> };
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index 7a8b3093218921f26a7f8962f94739ba49431230..534cf864101f8d1e5f4106b61c0580c858bc0e27 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -25,6 +25,7 @@
> #include <linux/mount.h>
> #include <linux/path.h>
> #include <linux/dax.h>
> +#include <linux/filelock.h>
> #include <linux/quotaops.h>
> #include <linux/pagevec.h>
> #include <linux/uio.h>
> @@ -980,6 +981,7 @@ const struct file_operations ext4_file_operations = {
> .fop_flags = FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
> FOP_DIO_PARALLEL_WRITE |
> FOP_DONTCACHE,
> + .setlease = generic_setlease,
> };
>
> const struct inode_operations ext4_file_inode_operations = {
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 15/24] ocfs2: add setlease file operation
2026-01-08 17:13 ` [PATCH 15/24] ocfs2: " Jeff Layton
@ 2026-01-08 17:29 ` Jan Kara
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:29 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:10, Jeff Layton wrote:
> Add the setlease file_operation to ocfs2_fops, ocfs2_dops,
> ocfs2_fops_no_plocks, and ocfs2_dops_no_plocks, pointing to
> generic_setlease. A future patch will change the default behavior to
> reject lease attempts with -EINVAL when there is no setlease file
> operation defined. Add generic_setlease to retain the ability to set
> leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ocfs2/file.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 732c61599159ccb1f8fbcbb44e848f78678221d9..ed961a854983d5e7abe935e160e3029c48e6fca4 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -19,6 +19,7 @@
> #include <linux/mount.h>
> #include <linux/writeback.h>
> #include <linux/falloc.h>
> +#include <linux/filelock.h>
> #include <linux/quotaops.h>
> #include <linux/blkdev.h>
> #include <linux/backing-dev.h>
> @@ -2823,6 +2824,7 @@ const struct file_operations ocfs2_fops = {
> .fallocate = ocfs2_fallocate,
> .remap_file_range = ocfs2_remap_file_range,
> .fop_flags = FOP_ASYNC_LOCK,
> + .setlease = generic_setlease,
> };
>
> WRAP_DIR_ITER(ocfs2_readdir) // FIXME!
> @@ -2840,6 +2842,7 @@ const struct file_operations ocfs2_dops = {
> .lock = ocfs2_lock,
> .flock = ocfs2_flock,
> .fop_flags = FOP_ASYNC_LOCK,
> + .setlease = generic_setlease,
> };
>
> /*
> @@ -2871,6 +2874,7 @@ const struct file_operations ocfs2_fops_no_plocks = {
> .splice_write = iter_file_splice_write,
> .fallocate = ocfs2_fallocate,
> .remap_file_range = ocfs2_remap_file_range,
> + .setlease = generic_setlease,
> };
>
> const struct file_operations ocfs2_dops_no_plocks = {
> @@ -2885,4 +2889,5 @@ const struct file_operations ocfs2_dops_no_plocks = {
> .compat_ioctl = ocfs2_compat_ioctl,
> #endif
> .flock = ocfs2_flock,
> + .setlease = generic_setlease,
> };
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 20/24] udf: add setlease file operation
2026-01-08 17:13 ` [PATCH 20/24] udf: " Jeff Layton
@ 2026-01-08 17:29 ` Jan Kara
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:29 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:15, Jeff Layton wrote:
> Add the setlease file_operation pointing to generic_setlease to the udf
> file_operations structures. A future patch will change the default
> behavior to reject lease attempts with -EINVAL when there is no
> setlease file operation defined. Add generic_setlease to retain the
> ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/udf/dir.c | 2 ++
> fs/udf/file.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/fs/udf/dir.c b/fs/udf/dir.c
> index 5023dfe191e8088b78396997a8915bf383f7a2d2..5bf75638f3520ecb3a0a2ade2279ab56787ecd11 100644
> --- a/fs/udf/dir.c
> +++ b/fs/udf/dir.c
> @@ -24,6 +24,7 @@
>
> #include <linux/string.h>
> #include <linux/errno.h>
> +#include <linux/filelock.h>
> #include <linux/mm.h>
> #include <linux/slab.h>
> #include <linux/bio.h>
> @@ -157,4 +158,5 @@ const struct file_operations udf_dir_operations = {
> .iterate_shared = udf_readdir,
> .unlocked_ioctl = udf_ioctl,
> .fsync = generic_file_fsync,
> + .setlease = generic_setlease,
> };
> diff --git a/fs/udf/file.c b/fs/udf/file.c
> index 0d76c4f37b3e71ffe6a883a8d97a6c3038d2a01d..32ae7cfd72c549958b70824b449cf146f6750f44 100644
> --- a/fs/udf/file.c
> +++ b/fs/udf/file.c
> @@ -28,6 +28,7 @@
> #include <linux/string.h> /* memset */
> #include <linux/capability.h>
> #include <linux/errno.h>
> +#include <linux/filelock.h>
> #include <linux/pagemap.h>
> #include <linux/uio.h>
>
> @@ -208,6 +209,7 @@ const struct file_operations udf_file_operations = {
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> .llseek = generic_file_llseek,
> + .setlease = generic_setlease,
> };
>
> static int udf_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 19/24] tmpfs: add setlease file operation
2026-01-08 17:13 ` [PATCH 19/24] tmpfs: " Jeff Layton
@ 2026-01-08 17:31 ` Jan Kara
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:31 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:14, Jeff Layton wrote:
> Add the setlease file_operation pointing to generic_setlease to the
> tmpfs file_operations structures. A future patch will change the
> default behavior to reject lease attempts with -EINVAL when there is no
> setlease file operation defined. Add generic_setlease to retain the
> ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/libfs.c | 2 ++
> mm/shmem.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/fs/libfs.c b/fs/libfs.c
> index 591eb649ebbacf202ff48cd3abd64a175daa291c..697c6d5fc12786c036f0086886297fb5cd52ae00 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -6,6 +6,7 @@
>
> #include <linux/blkdev.h>
> #include <linux/export.h>
> +#include <linux/filelock.h>
> #include <linux/pagemap.h>
> #include <linux/slab.h>
> #include <linux/cred.h>
> @@ -570,6 +571,7 @@ const struct file_operations simple_offset_dir_operations = {
> .iterate_shared = offset_readdir,
> .read = generic_read_dir,
> .fsync = noop_fsync,
> + .setlease = generic_setlease,
> };
>
> struct dentry *find_next_child(struct dentry *parent, struct dentry *prev)
> diff --git a/mm/shmem.c b/mm/shmem.c
> index ec6c01378e9d2bd47db9d7506e4d6a565e092185..88ef1fd5cd38efedbb31353da2871ab1d47e68a5 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -29,6 +29,7 @@
> #include <linux/pagemap.h>
> #include <linux/file.h>
> #include <linux/fileattr.h>
> +#include <linux/filelock.h>
> #include <linux/mm.h>
> #include <linux/random.h>
> #include <linux/sched/signal.h>
> @@ -5219,6 +5220,7 @@ static const struct file_operations shmem_file_operations = {
> .splice_read = shmem_file_splice_read,
> .splice_write = iter_file_splice_write,
> .fallocate = shmem_fallocate,
> + .setlease = generic_setlease,
> #endif
> };
>
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 23/24] filelock: default to returning -EINVAL when ->setlease operation is NULL
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
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:34 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:18, Jeff Layton wrote:
> Now that most filesystems where we expect to need lease support have
> their ->setlease() operations explicitly set, change kernel_setlease()
> to return -EINVAL when the setlease is a NULL pointer.
>
> Also update the Documentation/ with info about this change.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> Documentation/filesystems/porting.rst | 9 +++++++++
> Documentation/filesystems/vfs.rst | 9 ++++++---
> fs/locks.c | 3 +--
> 3 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst
> index 3397937ed838e5e7dfacc6379a9d71481cc30914..c0f7103628ab5ed70d142a5c7f6d95ca4734c741 100644
> --- a/Documentation/filesystems/porting.rst
> +++ b/Documentation/filesystems/porting.rst
> @@ -1334,3 +1334,12 @@ end_creating() and the parent will be unlocked precisely when necessary.
>
> kill_litter_super() is gone; convert to DCACHE_PERSISTENT use (as all
> in-tree filesystems have done).
> +
> +---
> +
> +**mandatory**
> +
> +The ->setlease() file_operation must now be explicitly set in order to provide
> +support for leases. When set to NULL, the kernel will now return -EINVAL to
> +attempts to set a lease. Filesystems that wish to use the kernel-internal lease
> +implementation should set it to generic_setlease().
> diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
> index 670ba66b60e4964927164a57e68adc0edfc681ee..21dc8921dd9ebedeafc4c108de7327f172138b6e 100644
> --- a/Documentation/filesystems/vfs.rst
> +++ b/Documentation/filesystems/vfs.rst
> @@ -1180,9 +1180,12 @@ otherwise noted.
> method is used by the splice(2) system call
>
> ``setlease``
> - called by the VFS to set or release a file lock lease. setlease
> - implementations should call generic_setlease to record or remove
> - the lease in the inode after setting it.
> + called by the VFS to set or release a file lock lease. Local
> + filesystems that wish to use the kernel-internal lease implementation
> + should set this to generic_setlease(). Other setlease implementations
> + should call generic_setlease() to record or remove the lease in the inode
> + after setting it. When set to NULL, attempts to set or remove a lease will
> + return -EINVAL.
>
> ``fallocate``
> called by the VFS to preallocate blocks or punch a hole.
> diff --git a/fs/locks.c b/fs/locks.c
> index e2036aa4bd3734be415296f9157d8f17166878aa..ea38a18f373c2202ba79e8e37125f8d32a0e2d42 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -2016,8 +2016,7 @@ kernel_setlease(struct file *filp, int arg, struct file_lease **lease, void **pr
> setlease_notifier(arg, *lease);
> if (filp->f_op->setlease)
> return filp->f_op->setlease(filp, arg, lease, priv);
> - else
> - return generic_setlease(filp, arg, lease, priv);
> + return -EINVAL;
> }
> EXPORT_SYMBOL_GPL(kernel_setlease);
>
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 24/24] fs: remove simple_nosetlease()
2026-01-08 17:13 ` [PATCH 24/24] fs: remove simple_nosetlease() Jeff Layton
@ 2026-01-08 17:34 ` Jan Kara
0 siblings, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:34 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 12:13:19, Jeff Layton wrote:
> Setting ->setlease() to a NULL pointer now has the same effect as
> setting it to simple_nosetlease(). Remove all of the setlease
> file_operations that are set to simple_nosetlease, and the function
> itself.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Nice. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/9p/vfs_dir.c | 2 --
> fs/9p/vfs_file.c | 2 --
> fs/ceph/dir.c | 2 --
> fs/ceph/file.c | 1 -
> fs/fuse/dir.c | 1 -
> fs/gfs2/file.c | 2 --
> fs/libfs.c | 18 ------------------
> fs/nfs/dir.c | 1 -
> fs/nfs/file.c | 1 -
> fs/smb/client/cifsfs.c | 1 -
> fs/vboxsf/dir.c | 1 -
> fs/vboxsf/file.c | 1 -
> include/linux/fs.h | 1 -
> 13 files changed, 34 deletions(-)
>
> diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
> index af7f72abbb76aaff934b80d4002f32e3b0d17b6d..e0d34e4e9076e3b1a6c5ed07a3e009a50c9fa2a9 100644
> --- a/fs/9p/vfs_dir.c
> +++ b/fs/9p/vfs_dir.c
> @@ -242,7 +242,6 @@ const struct file_operations v9fs_dir_operations = {
> .iterate_shared = v9fs_dir_readdir,
> .open = v9fs_file_open,
> .release = v9fs_dir_release,
> - .setlease = simple_nosetlease,
> };
>
> const struct file_operations v9fs_dir_operations_dotl = {
> @@ -252,5 +251,4 @@ const struct file_operations v9fs_dir_operations_dotl = {
> .open = v9fs_file_open,
> .release = v9fs_dir_release,
> .fsync = v9fs_file_fsync_dotl,
> - .setlease = simple_nosetlease,
> };
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 6f3880208587e39d965dcd4b4280a2079a36b4a2..c5e73c37baea55394294b939fdda7170db8503c0 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -517,7 +517,6 @@ const struct file_operations v9fs_file_operations = {
> .splice_read = v9fs_file_splice_read,
> .splice_write = iter_file_splice_write,
> .fsync = v9fs_file_fsync,
> - .setlease = simple_nosetlease,
> };
>
> const struct file_operations v9fs_file_operations_dotl = {
> @@ -532,5 +531,4 @@ const struct file_operations v9fs_file_operations_dotl = {
> .splice_read = v9fs_file_splice_read,
> .splice_write = iter_file_splice_write,
> .fsync = v9fs_file_fsync_dotl,
> - .setlease = simple_nosetlease,
> };
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index 804588524cd570078ba59bf38d2460950ca67daf..86d7aa594ea99335af3e91a95c0a418fdc1b8a8a 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -2214,7 +2214,6 @@ const struct file_operations ceph_dir_fops = {
> .fsync = ceph_fsync,
> .lock = ceph_lock,
> .flock = ceph_flock,
> - .setlease = simple_nosetlease,
> };
>
> const struct file_operations ceph_snapdir_fops = {
> @@ -2222,7 +2221,6 @@ const struct file_operations ceph_snapdir_fops = {
> .llseek = ceph_dir_llseek,
> .open = ceph_open,
> .release = ceph_release,
> - .setlease = simple_nosetlease,
> };
>
> const struct inode_operations ceph_dir_iops = {
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index 983390069f737254e8c7bcad1718f375499f443e..31b691b2aea21f04c6d6c9aacbfd664c13a3ef64 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -3169,7 +3169,6 @@ const struct file_operations ceph_file_fops = {
> .mmap_prepare = ceph_mmap_prepare,
> .fsync = ceph_fsync,
> .lock = ceph_lock,
> - .setlease = simple_nosetlease,
> .flock = ceph_flock,
> .splice_read = ceph_splice_read,
> .splice_write = iter_file_splice_write,
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index 4b6b3d2758ff225dc389016017753b09fadff9d1..d6ee2d38fc2dad5c0995b62dd589e7a46d18424d 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -2421,7 +2421,6 @@ static const struct file_operations fuse_dir_operations = {
> .fsync = fuse_dir_fsync,
> .unlocked_ioctl = fuse_dir_ioctl,
> .compat_ioctl = fuse_dir_compat_ioctl,
> - .setlease = simple_nosetlease,
> };
>
> static const struct inode_operations fuse_common_inode_operations = {
> diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
> index 6daa96d815e1e30f099938543a0ed19aa90c720c..3e061e8115ece08c7cb6594b8adb653ccec998ed 100644
> --- a/fs/gfs2/file.c
> +++ b/fs/gfs2/file.c
> @@ -1593,7 +1593,6 @@ const struct file_operations gfs2_file_fops = {
> .flock = gfs2_flock,
> .splice_read = copy_splice_read,
> .splice_write = gfs2_file_splice_write,
> - .setlease = simple_nosetlease,
> .fallocate = gfs2_fallocate,
> .fop_flags = FOP_ASYNC_LOCK,
> };
> @@ -1608,7 +1607,6 @@ const struct file_operations gfs2_dir_fops = {
> .lock = gfs2_lock,
> .flock = gfs2_flock,
> .llseek = default_llseek,
> - .setlease = simple_nosetlease,
> .fop_flags = FOP_ASYNC_LOCK,
> };
>
> diff --git a/fs/libfs.c b/fs/libfs.c
> index 697c6d5fc12786c036f0086886297fb5cd52ae00..f1860dff86f2703266beecf31e9d2667af7a9684 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -1699,24 +1699,6 @@ struct inode *alloc_anon_inode(struct super_block *s)
> }
> EXPORT_SYMBOL(alloc_anon_inode);
>
> -/**
> - * simple_nosetlease - generic helper for prohibiting leases
> - * @filp: file pointer
> - * @arg: type of lease to obtain
> - * @flp: new lease supplied for insertion
> - * @priv: private data for lm_setup operation
> - *
> - * Generic helper for filesystems that do not wish to allow leases to be set.
> - * All arguments are ignored and it just returns -EINVAL.
> - */
> -int
> -simple_nosetlease(struct file *filp, int arg, struct file_lease **flp,
> - void **priv)
> -{
> - return -EINVAL;
> -}
> -EXPORT_SYMBOL(simple_nosetlease);
> -
> /**
> * simple_get_link - generic helper to get the target of "fast" symlinks
> * @dentry: not used here
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index 71df279febf797880ded19e45528c3df4cea2dde..23a78a742b619dea8b76ddf28f4f59a1c8a015e2 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -66,7 +66,6 @@ const struct file_operations nfs_dir_operations = {
> .open = nfs_opendir,
> .release = nfs_closedir,
> .fsync = nfs_fsync_dir,
> - .setlease = simple_nosetlease,
> };
>
> const struct address_space_operations nfs_dir_aops = {
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index d020aab40c64ebda30d130b6acee1b9194621457..9d269561961825f88529551b0f0287920960ac62 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -962,7 +962,6 @@ const struct file_operations nfs_file_operations = {
> .splice_read = nfs_file_splice_read,
> .splice_write = iter_file_splice_write,
> .check_flags = nfs_check_flags,
> - .setlease = simple_nosetlease,
> .fop_flags = FOP_DONTCACHE,
> };
> EXPORT_SYMBOL_GPL(nfs_file_operations);
> diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
> index a3dc7cb1ab541d35c2e43eefb7a2d2d23ad88bb3..8015df1f711e150a0afb44875899435303d9d406 100644
> --- a/fs/smb/client/cifsfs.c
> +++ b/fs/smb/client/cifsfs.c
> @@ -1709,7 +1709,6 @@ const struct file_operations cifs_dir_ops = {
> .remap_file_range = cifs_remap_file_range,
> .llseek = generic_file_llseek,
> .fsync = cifs_dir_fsync,
> - .setlease = simple_nosetlease,
> };
>
> static void
> diff --git a/fs/vboxsf/dir.c b/fs/vboxsf/dir.c
> index 230d7589d15cc98f6bc7e930ba40ca5f7dbf7e18..42bedc4ec7af7709c564a7174805d185ce86f854 100644
> --- a/fs/vboxsf/dir.c
> +++ b/fs/vboxsf/dir.c
> @@ -186,7 +186,6 @@ const struct file_operations vboxsf_dir_fops = {
> .release = vboxsf_dir_release,
> .read = generic_read_dir,
> .llseek = generic_file_llseek,
> - .setlease = simple_nosetlease,
> };
>
> /*
> diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c
> index 4bebd947314a796365728b3af1c46b0d7070abc1..111752010edb2ba48ee1fdf0e3729369c6521ee8 100644
> --- a/fs/vboxsf/file.c
> +++ b/fs/vboxsf/file.c
> @@ -218,7 +218,6 @@ const struct file_operations vboxsf_reg_fops = {
> .release = vboxsf_file_release,
> .fsync = noop_fsync,
> .splice_read = filemap_splice_read,
> - .setlease = simple_nosetlease,
> };
>
> const struct inode_operations vboxsf_reg_iops = {
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index f5c9cf28c4dcf9ec648f0fc4f3f4bb44d1b1c482..e46e8aad9339357f99c40eede8ca7b6b727284fe 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3217,7 +3217,6 @@ extern int always_delete_dentry(const struct dentry *);
> extern struct inode *alloc_anon_inode(struct super_block *);
> struct inode *anon_inode_make_secure_inode(struct super_block *sb, const char *name,
> const struct inode *context_inode);
> -extern int simple_nosetlease(struct file *, int, struct file_lease **, void **);
>
> extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
> extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
>
> --
> 2.52.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (23 preceding siblings ...)
2026-01-08 17:13 ` [PATCH 24/24] fs: remove simple_nosetlease() Jeff Layton
@ 2026-01-08 17:40 ` Jan Kara
2026-01-08 18:56 ` Jeff Layton
2026-01-09 6:00 ` Christoph Hellwig
2026-01-09 8:03 ` Al Viro
26 siblings, 1 reply; 50+ messages in thread
From: Jan Kara @ 2026-01-08 17:40 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
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...
Honza
>
> [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>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 09/24] fat: add setlease file operation
2026-01-08 17:13 ` [PATCH 09/24] fat: " Jeff Layton
@ 2026-01-08 18:12 ` OGAWA Hirofumi
0 siblings, 0 replies; 50+ messages in thread
From: OGAWA Hirofumi @ 2026-01-08 18:12 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
David Woodhouse, Richard Weinberger, Dave Kleikamp,
Ryusuke Konishi, Viacheslav Dubeyko, Konstantin Komarov,
Mark Fasheh, Joel Becker, Joseph Qi, Mike Marshall,
Martin Brandenburg, Miklos Szeredi, Amir Goldstein,
Phillip Lougher, Carlos Maiolino, Hugh Dickins, Baolin Wang,
Andrew Morton, Namjae Jeon, Sungjong Seo, Yuezhang Mo,
Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
Jeff Layton <jlayton@kernel.org> writes:
> Add the setlease file_operation to fat_file_operations and
> fat_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good.
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> ---
> fs/fat/dir.c | 2 ++
> fs/fat/file.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/fs/fat/dir.c b/fs/fat/dir.c
> index 92b091783966af6a9e6f5ead1a382a98dd92bba0..807bc8b1bc145a9f15765920670c6233f7e87e55 100644
> --- a/fs/fat/dir.c
> +++ b/fs/fat/dir.c
> @@ -16,6 +16,7 @@
>
> #include <linux/slab.h>
> #include <linux/compat.h>
> +#include <linux/filelock.h>
> #include <linux/uaccess.h>
> #include <linux/iversion.h>
> #include "fat.h"
> @@ -876,6 +877,7 @@ const struct file_operations fat_dir_operations = {
> .compat_ioctl = fat_compat_dir_ioctl,
> #endif
> .fsync = fat_file_fsync,
> + .setlease = generic_setlease,
> };
>
> static int fat_get_short_entry(struct inode *dir, loff_t *pos,
> diff --git a/fs/fat/file.c b/fs/fat/file.c
> index 4fc49a614fb8fd64e219db60c6d9e7dd100aea1c..d50a6d8bfaae0c75b2dbe838d108135206d0f123 100644
> --- a/fs/fat/file.c
> +++ b/fs/fat/file.c
> @@ -13,6 +13,7 @@
> #include <linux/mount.h>
> #include <linux/blkdev.h>
> #include <linux/backing-dev.h>
> +#include <linux/filelock.h>
> #include <linux/fsnotify.h>
> #include <linux/security.h>
> #include <linux/falloc.h>
> @@ -212,6 +213,7 @@ const struct file_operations fat_file_operations = {
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> .fallocate = fat_fallocate,
> + .setlease = generic_setlease,
> };
>
> static int fat_cont_expand(struct inode *inode, loff_t size)
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
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
2026-01-09 9:26 ` Jan Kara
2026-01-09 18:52 ` Amir Goldstein
0 siblings, 2 replies; 50+ messages in thread
From: Jeff Layton @ 2026-01-08 18:56 UTC (permalink / raw)
To: Jan Kara
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
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>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 12/24] jfs: add setlease file operation
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
1 sibling, 0 replies; 50+ messages in thread
From: Dave Kleikamp @ 2026-01-08 19:46 UTC (permalink / raw)
To: Jeff Layton, Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
On 1/8/26 11:13AM, Jeff Layton wrote:
> Add the setlease file_operation to jfs_file_operations and
> jfs_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/jfs/file.c | 2 ++
> fs/jfs/namei.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/fs/jfs/file.c b/fs/jfs/file.c
> index 87ad042221e78959200cce12a59a3ffd6d06c0d7..246568cb9a6ec144831eb3592712cce323d8cf1d 100644
> --- a/fs/jfs/file.c
> +++ b/fs/jfs/file.c
> @@ -6,6 +6,7 @@
>
> #include <linux/mm.h>
> #include <linux/fs.h>
> +#include <linux/filelock.h>
> #include <linux/posix_acl.h>
> #include <linux/quotaops.h>
> #include "jfs_incore.h"
> @@ -153,4 +154,5 @@ const struct file_operations jfs_file_operations = {
> .release = jfs_release,
> .unlocked_ioctl = jfs_ioctl,
> .compat_ioctl = compat_ptr_ioctl,
> + .setlease = generic_setlease,
> };
> diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
> index 65a218eba8faf9508f5727515b812f6de2661618..f7e2ae7a4c37ed87675f0ccb3276b37e6ce08cb4 100644
> --- a/fs/jfs/namei.c
> +++ b/fs/jfs/namei.c
> @@ -5,6 +5,7 @@
> */
>
> #include <linux/fs.h>
> +#include <linux/filelock.h>
> #include <linux/namei.h>
> #include <linux/ctype.h>
> #include <linux/quotaops.h>
> @@ -1545,6 +1546,7 @@ const struct file_operations jfs_dir_operations = {
> .unlocked_ioctl = jfs_ioctl,
> .compat_ioctl = compat_ptr_ioctl,
> .llseek = generic_file_llseek,
> + .setlease = generic_setlease,
> };
>
> static int jfs_ci_hash(const struct dentry *dir, struct qstr *this)
>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 02/24] affs: add setlease file operation
2026-01-08 17:12 ` [PATCH 02/24] affs: add setlease file operation Jeff Layton
@ 2026-01-08 21:26 ` David Sterba
0 siblings, 0 replies; 50+ messages in thread
From: David Sterba @ 2026-01-08 21:26 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu, Jan 08, 2026 at 12:12:57PM -0500, Jeff Layton wrote:
> Add the setlease file_operation to affs_file_operations and
> affs_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Acked-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 03/24] btrfs: add setlease file operation
2026-01-08 17:12 ` [PATCH 03/24] btrfs: " Jeff Layton
@ 2026-01-08 21:26 ` David Sterba
0 siblings, 0 replies; 50+ messages in thread
From: David Sterba @ 2026-01-08 21:26 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu, Jan 08, 2026 at 12:12:58PM -0500, Jeff Layton wrote:
> Add the setlease file_operation to btrfs_file_operations and
> btrfs_dir_file_operations, pointing to generic_setlease. A future
> patch will change the default behavior to reject lease attempts with
> -EINVAL when there is no setlease file operation defined. Add
> generic_setlease to retain the ability to set leases on this
> filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Acked-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 07/24] exfat: add setlease file operation
2026-01-08 17:13 ` [PATCH 07/24] exfat: " Jeff Layton
@ 2026-01-08 22:47 ` Namjae Jeon
0 siblings, 0 replies; 50+ messages in thread
From: Namjae Jeon @ 2026-01-08 22:47 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Sungjong Seo, Yuezhang Mo,
Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Fri, Jan 9, 2026 at 2:14 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> Add the setlease file_operation to exfat_file_operations and
> exfat_dir_operations, pointing to generic_setlease. A future patch
> will change the default behavior to reject lease attempts with -EINVAL
> when there is no setlease file operation defined. Add generic_setlease
> to retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Thanks!
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 13/24] nilfs2: add setlease file operation
2026-01-08 17:13 ` [PATCH 13/24] nilfs2: " Jeff Layton
@ 2026-01-09 5:26 ` Ryusuke Konishi
0 siblings, 0 replies; 50+ messages in thread
From: Ryusuke Konishi @ 2026-01-09 5:26 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Viacheslav Dubeyko, Konstantin Komarov,
Mark Fasheh, Joel Becker, Joseph Qi, Mike Marshall,
Martin Brandenburg, Miklos Szeredi, Amir Goldstein,
Phillip Lougher, Carlos Maiolino, Hugh Dickins, Baolin Wang,
Andrew Morton, Namjae Jeon, Sungjong Seo, Yuezhang Mo,
Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Fri, Jan 9, 2026 at 2:15 AM Jeff Layton wrote:
>
> Add the setlease file_operation to nilfs_file_operations and
> nilfs_dir_operations, pointing to generic_setlease. A future patch
> will change the default behavior to reject lease attempts with -EINVAL
> when there is no setlease file operation defined. Add generic_setlease
> to retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Looks good, Thanks!
Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Ryusuke Konishi
> ---
> fs/nilfs2/dir.c | 3 ++-
> fs/nilfs2/file.c | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
> index 6ca3d74be1e16d5bc577e2520f1e841287a2511f..b243199036dfa1ab2299efaaa5bdf5da2d159ff2 100644
> --- a/fs/nilfs2/dir.c
> +++ b/fs/nilfs2/dir.c
> @@ -30,6 +30,7 @@
> */
>
> #include <linux/pagemap.h>
> +#include <linux/filelock.h>
> #include "nilfs.h"
> #include "page.h"
>
> @@ -661,5 +662,5 @@ const struct file_operations nilfs_dir_operations = {
> .compat_ioctl = nilfs_compat_ioctl,
> #endif /* CONFIG_COMPAT */
> .fsync = nilfs_sync_file,
> -
> + .setlease = generic_setlease,
> };
> diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
> index 1b8d754db44d44d25dcd13f008d266ec83c74d3f..f93b68c4877c5ed369e90b723517e117142335de 100644
> --- a/fs/nilfs2/file.c
> +++ b/fs/nilfs2/file.c
> @@ -8,6 +8,7 @@
> */
>
> #include <linux/fs.h>
> +#include <linux/filelock.h>
> #include <linux/mm.h>
> #include <linux/writeback.h>
> #include "nilfs.h"
> @@ -150,6 +151,7 @@ const struct file_operations nilfs_file_operations = {
> .fsync = nilfs_sync_file,
> .splice_read = filemap_splice_read,
> .splice_write = iter_file_splice_write,
> + .setlease = generic_setlease,
> };
>
> const struct inode_operations nilfs_file_inode_operations = {
>
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (24 preceding siblings ...)
2026-01-08 17:40 ` [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jan Kara
@ 2026-01-09 6:00 ` Christoph Hellwig
2026-01-09 8:03 ` Al Viro
26 siblings, 0 replies; 50+ messages in thread
From: Christoph Hellwig @ 2026-01-09 6:00 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu, Jan 08, 2026 at 12:12:55PM -0500, Jeff Layton wrote:
> 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.
>
> [1]: https://lore.kernel.org/linux-fsdevel/20260107-setlease-6-19-v1-0-85f034abcc57@kernel.org/
That seems reasonable, and I like the approach here (without having the
time to review every change right now):
Acked-by: Christoph Hellwig <hch@lst.de>
If it turns out we have people use leases on other file systems we'll
have to wire up a few more instance as needed, but I think your initial
set makes sense.
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 12/24] jfs: add setlease file operation
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
1 sibling, 1 reply; 50+ messages in thread
From: Richard Weinberger @ 2026-01-09 7:40 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Al Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, tytso, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Dave Kleikamp, Ryusuke Konishi,
Viacheslav Dubeyko, Konstantin Komarov, Mark Fasheh, Joel Becker,
Joseph Qi, Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, hughd,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, chuck lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
Xiubo Li, Ilya Dryomov, Trond Myklebust, anna, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N, Tom Talpey,
Bharath SM, Hans de Goede, linux-kernel, linux-fsdevel,
linux-btrfs, linux-erofs, linux-ext4, linux-f2fs-devel,
linux-mtd, jfs-discussion, linux-nilfs, ntfs3, ocfs2-devel,
devel, linux-unionfs, linux-xfs, linux-mm, gfs2,
Linux Doc Mailing List, v9fs, ceph-devel, linux-nfs, linux-cifs,
samba-technical
----- Ursprüngliche Mail -----
> Von: "Jeff Layton" <jlayton@kernel.org>
> Add the setlease file_operation to jfs_file_operations and
> jfs_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/jfs/file.c | 2 ++
> fs/jfs/namei.c | 2 ++
> 2 files changed, 4 insertions(+)
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
` (25 preceding siblings ...)
2026-01-09 6:00 ` Christoph Hellwig
@ 2026-01-09 8:03 ` Al Viro
26 siblings, 0 replies; 50+ messages in thread
From: Al Viro @ 2026-01-09 8:03 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Christian Brauner,
David Sterba, Chris Mason, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
Sandeep Dhavale, Hongbo Li, Chunhai Guo, Jan Kara,
Theodore Ts'o, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Richard Weinberger, Dave Kleikamp,
Ryusuke Konishi, Viacheslav Dubeyko, Konstantin Komarov,
Mark Fasheh, Joel Becker, Joseph Qi, Mike Marshall,
Martin Brandenburg, Miklos Szeredi, Amir Goldstein,
Phillip Lougher, Carlos Maiolino, Hugh Dickins, Baolin Wang,
Andrew Morton, Namjae Jeon, Sungjong Seo, Yuezhang Mo,
Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu, Jan 08, 2026 at 12:12:55PM -0500, Jeff Layton wrote:
> 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.
Series looks sane and I don't see any obvious gaps.
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 12/24] jfs: add setlease file operation
2026-01-09 7:40 ` Richard Weinberger
@ 2026-01-09 8:48 ` Richard Weinberger
0 siblings, 0 replies; 50+ messages in thread
From: Richard Weinberger @ 2026-01-09 8:48 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Al Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, tytso, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Dave Kleikamp, Ryusuke Konishi,
Viacheslav Dubeyko, Konstantin Komarov, Mark Fasheh, Joel Becker,
Joseph Qi, Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, hughd,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, chuck lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
Xiubo Li, Ilya Dryomov, Trond Myklebust, anna, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam, Tom Talpey, Bharath SM,
Hans de Goede, linux-kernel, linux-fsdevel, linux-btrfs,
linux-erofs, linux-ext4, linux-f2fs-devel, linux-mtd,
jfs-discussion, linux-nilfs, ntfs3, ocfs2-devel, devel,
linux-unionfs, linux-xfs, linux-mm, gfs2, Linux Doc Mailing List,
v9fs, ceph-devel, linux-nfs, linux-cifs, samba-technical
----- Ursprüngliche Mail -----
> Von: "richard" <richard@nod.at>
>> ---
>> fs/jfs/file.c | 2 ++
>> fs/jfs/namei.c | 2 ++
>> 2 files changed, 4 insertions(+)
>
> Acked-by: Richard Weinberger <richard@nod.at>
Whoops! I meant to reply to the jffs2 patch...
Thanks,
//richard
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 11/24] jffs2: add setlease file operation
2026-01-08 17:13 ` [PATCH 11/24] jffs2: add " Jeff Layton
@ 2026-01-09 8:49 ` Richard Weinberger
0 siblings, 0 replies; 50+ messages in thread
From: Richard Weinberger @ 2026-01-09 8:49 UTC (permalink / raw)
To: Jeff Layton
Cc: Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Al Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, tytso, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Dave Kleikamp, Ryusuke Konishi,
Viacheslav Dubeyko, Konstantin Komarov, Mark Fasheh, Joel Becker,
Joseph Qi, Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, hughd,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, chuck lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Christian Schoenebeck,
Xiubo Li, Ilya Dryomov, Trond Myklebust, anna, Steve French,
Paulo Alcantara, Ronnie Sahlberg, Shyam, Tom Talpey, Bharath SM,
Hans de Goede, linux-kernel, linux-fsdevel, linux-btrfs,
linux-erofs, linux-ext4, linux-f2fs-devel, linux-mtd,
jfs-discussion, linux-nilfs, ntfs3, ocfs2-devel, devel,
linux-unionfs, linux-xfs, linux-mm, gfs2, Linux Doc Mailing List,
v9fs, ceph-devel, linux-nfs, linux-cifs, samba-technical
----- Ursprüngliche Mail -----
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/jffs2/dir.c | 2 ++
> fs/jffs2/file.c | 2 ++
> 2 files changed, 4 insertions(+)
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
2026-01-08 18:56 ` Jeff Layton
@ 2026-01-09 9:26 ` Jan Kara
2026-01-09 18:52 ` Amir Goldstein
1 sibling, 0 replies; 50+ messages in thread
From: Jan Kara @ 2026-01-09 9:26 UTC (permalink / raw)
To: Jeff Layton
Cc: Jan Kara, Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Chao Yu,
Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
Jan Kara, Theodore Ts'o, Andreas Dilger, Jaegeuk Kim,
OGAWA Hirofumi, David Woodhouse, Richard Weinberger,
Dave Kleikamp, Ryusuke Konishi, Viacheslav Dubeyko,
Konstantin Komarov, Mark Fasheh, Joel Becker, Joseph Qi,
Mike Marshall, Martin Brandenburg, Miklos Szeredi,
Amir Goldstein, Phillip Lougher, Carlos Maiolino, Hugh Dickins,
Baolin Wang, Andrew Morton, Namjae Jeon, Sungjong Seo,
Yuezhang Mo, Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu 08-01-26 13:56:57, Jeff Layton wrote:
> 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.
I agree exporting kernfs based filesystem doesn't make a huge amount of
sense.
> 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.
Yeah, this makes sense at least for some transition period so that we
faster learn if our judgement about sane / insane lease use was wrong.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support
2026-01-08 18:56 ` Jeff Layton
2026-01-09 9:26 ` Jan Kara
@ 2026-01-09 18:52 ` Amir Goldstein
1 sibling, 0 replies; 50+ messages in thread
From: Amir Goldstein @ 2026-01-09 18:52 UTC (permalink / raw)
To: Jeff Layton, Christian Brauner
Cc: Jan Kara, Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Anders Larsen, Alexander Viro, David Sterba,
Chris Mason, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
Sandeep Dhavale, Hongbo Li, Chunhai Guo, Jan Kara,
Theodore Ts'o, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Richard Weinberger, Dave Kleikamp,
Ryusuke Konishi, Viacheslav Dubeyko, Konstantin Komarov,
Mark Fasheh, Joel Becker, Joseph Qi, Mike Marshall,
Martin Brandenburg, Miklos Szeredi, Phillip Lougher,
Carlos Maiolino, Hugh Dickins, Baolin Wang, Andrew Morton,
Namjae Jeon, Sungjong Seo, Yuezhang Mo, Chuck Lever,
Alexander Aring, Andreas Gruenbacher, Jonathan Corbet,
Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede,
linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On Thu, Jan 8, 2026 at 7:57 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> 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.
IMO, you are being too cautious, but whatever.
It is not accurate that kernfs filesystems are NFS exportable in general.
Only cgroupfs has KERNFS_ROOT_SUPPORT_EXPORTOP.
If any application is using leases on cgroup files, it must be some
very advanced runtime (i.e. systemd), so we should know about the
regression sooner rather than later.
There are also the recently added nsfs and pidfs export_operations.
I have a recollection about wanting to be explicit about not allowing
those to be exportable to NFS (nsfs specifically), but I can't see where
and if that restriction was done.
Christian? Do you remember?
Thanks,
Amir.
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 04/24] erofs: add setlease file operation
2026-01-08 17:12 ` [PATCH 04/24] erofs: " Jeff Layton
@ 2026-01-10 1:47 ` Chao Yu
0 siblings, 0 replies; 50+ messages in thread
From: Chao Yu @ 2026-01-10 1:47 UTC (permalink / raw)
To: Jeff Layton, Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Yue Hu,
Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo, Jan Kara,
Theodore Ts'o, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Richard Weinberger, Dave Kleikamp,
Ryusuke Konishi, Viacheslav Dubeyko, Konstantin Komarov,
Mark Fasheh, Joel Becker, Joseph Qi, Mike Marshall,
Martin Brandenburg, Miklos Szeredi, Amir Goldstein,
Phillip Lougher, Carlos Maiolino, Hugh Dickins, Baolin Wang,
Andrew Morton, Namjae Jeon, Sungjong Seo, Yuezhang Mo,
Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: chao, linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On 1/9/2026 1:12 AM, Jeff Layton wrote:
> Add the setlease file_operation to erofs_file_fops and erofs_dir_fops,
> pointing to generic_setlease. A future patch will change the default
> behavior to reject lease attempts with -EINVAL when there is no
> setlease file operation defined. Add generic_setlease to retain the
> ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 08/24] f2fs: add setlease file operation
2026-01-08 17:13 ` [PATCH 08/24] f2fs: " Jeff Layton
@ 2026-01-10 1:47 ` Chao Yu
0 siblings, 0 replies; 50+ messages in thread
From: Chao Yu @ 2026-01-10 1:47 UTC (permalink / raw)
To: Jeff Layton, Luis de Bethencourt, Salah Triki, Nicolas Pitre,
Christoph Hellwig, Jan Kara, Anders Larsen, Alexander Viro,
Christian Brauner, David Sterba, Chris Mason, Gao Xiang, Yue Hu,
Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo, Jan Kara,
Theodore Ts'o, Andreas Dilger, Jaegeuk Kim, OGAWA Hirofumi,
David Woodhouse, Richard Weinberger, Dave Kleikamp,
Ryusuke Konishi, Viacheslav Dubeyko, Konstantin Komarov,
Mark Fasheh, Joel Becker, Joseph Qi, Mike Marshall,
Martin Brandenburg, Miklos Szeredi, Amir Goldstein,
Phillip Lougher, Carlos Maiolino, Hugh Dickins, Baolin Wang,
Andrew Morton, Namjae Jeon, Sungjong Seo, Yuezhang Mo,
Chuck Lever, Alexander Aring, Andreas Gruenbacher,
Jonathan Corbet, Matthew Wilcox (Oracle),
Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Christian Schoenebeck, Xiubo Li, Ilya Dryomov, Trond Myklebust,
Anna Schumaker, Steve French, Paulo Alcantara, Ronnie Sahlberg,
Shyam Prasad N, Tom Talpey, Bharath SM, Hans de Goede
Cc: chao, linux-kernel, linux-fsdevel, linux-btrfs, linux-erofs,
linux-ext4, linux-f2fs-devel, linux-mtd, jfs-discussion,
linux-nilfs, ntfs3, ocfs2-devel, devel, linux-unionfs, linux-xfs,
linux-mm, gfs2, linux-doc, v9fs, ceph-devel, linux-nfs,
linux-cifs, samba-technical
On 1/9/2026 1:13 AM, Jeff Layton wrote:
> Add the setlease file_operation to f2fs_file_operations and
> f2fs_dir_operations, pointing to generic_setlease. A future patch will
> change the default behavior to reject lease attempts with -EINVAL when
> there is no setlease file operation defined. Add generic_setlease to
> retain the ability to set leases on this filesystem.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 50+ messages in thread
end of thread, other threads:[~2026-01-10 1:48 UTC | newest]
Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support 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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox