From f9688474e413f607f1a4e047d970b50dc268c84c Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 8 Jan 2026 12:12:58 -0500 Subject: [PATCH] btrfs: add setlease file operation 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 Link: https://patch.msgid.link/20260108-setlease-6-20-v1-3-ea4dec9b67fa@kernel.org Acked-by: David Sterba Acked-by: Al Viro Acked-by: Christoph Hellwig Signed-off-by: Christian Brauner --- 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 1abc7ed2990e0..aca2b541e72df 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -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 d2b302ac6af96..d377794b4c9fa 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -10596,6 +10597,7 @@ static const struct file_operations btrfs_dir_file_operations = { #endif .release = btrfs_release_file, .fsync = btrfs_sync_file, + .setlease = generic_setlease, }; /* -- 2.47.3