Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: add setlease to generic_ro_fops and read-only filesystem directory operations

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>
Link: https://patch.msgid.link/20260108-setlease-6-20-v1-1-ea4dec9b67fa@kernel.org
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
ca4388bf 7d42f2b1

+16
+2
fs/befs/linuxvfs.c
··· 14 14 #include <linux/fs_context.h> 15 15 #include <linux/fs_parser.h> 16 16 #include <linux/errno.h> 17 + #include <linux/filelock.h> 17 18 #include <linux/stat.h> 18 19 #include <linux/nls.h> 19 20 #include <linux/buffer_head.h> ··· 80 79 .read = generic_read_dir, 81 80 .iterate_shared = befs_readdir, 82 81 .llseek = generic_file_llseek, 82 + .setlease = generic_setlease, 83 83 }; 84 84 85 85 static const struct inode_operations befs_dir_inode_operations = {
+2
fs/cramfs/inode.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/fs.h> 18 18 #include <linux/file.h> 19 + #include <linux/filelock.h> 19 20 #include <linux/pagemap.h> 20 21 #include <linux/ramfs.h> 21 22 #include <linux/init.h> ··· 939 938 .llseek = generic_file_llseek, 940 939 .read = generic_read_dir, 941 940 .iterate_shared = cramfs_readdir, 941 + .setlease = generic_setlease, 942 942 }; 943 943 944 944 static const struct inode_operations cramfs_dir_inode_operations = {
+2
fs/efs/dir.c
··· 6 6 */ 7 7 8 8 #include <linux/buffer_head.h> 9 + #include <linux/filelock.h> 9 10 #include "efs.h" 10 11 11 12 static int efs_readdir(struct file *, struct dir_context *); ··· 15 14 .llseek = generic_file_llseek, 16 15 .read = generic_read_dir, 17 16 .iterate_shared = efs_readdir, 17 + .setlease = generic_setlease, 18 18 }; 19 19 20 20 const struct inode_operations efs_dir_inode_operations = {
+2
fs/freevxfs/vxfs_lookup.c
··· 8 8 * Veritas filesystem driver - lookup and other directory related code. 9 9 */ 10 10 #include <linux/fs.h> 11 + #include <linux/filelock.h> 11 12 #include <linux/time.h> 12 13 #include <linux/mm.h> 13 14 #include <linux/highmem.h> ··· 37 36 .llseek = generic_file_llseek, 38 37 .read = generic_read_dir, 39 38 .iterate_shared = vxfs_readdir, 39 + .setlease = generic_setlease, 40 40 }; 41 41 42 42
+2
fs/isofs/dir.c
··· 12 12 * isofs directory handling functions 13 13 */ 14 14 #include <linux/gfp.h> 15 + #include <linux/filelock.h> 15 16 #include "isofs.h" 16 17 17 18 int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode) ··· 272 271 .llseek = generic_file_llseek, 273 272 .read = generic_read_dir, 274 273 .iterate_shared = isofs_readdir, 274 + .setlease = generic_setlease, 275 275 }; 276 276 277 277 /*
+2
fs/qnx4/dir.c
··· 13 13 */ 14 14 15 15 #include <linux/buffer_head.h> 16 + #include <linux/filelock.h> 16 17 #include "qnx4.h" 17 18 18 19 static int qnx4_readdir(struct file *file, struct dir_context *ctx) ··· 72 71 .read = generic_read_dir, 73 72 .iterate_shared = qnx4_readdir, 74 73 .fsync = generic_file_fsync, 74 + .setlease = generic_setlease, 75 75 }; 76 76 77 77 const struct inode_operations qnx4_dir_inode_operations =
+2
fs/qnx6/dir.c
··· 11 11 * 12 12 */ 13 13 14 + #include <linux/filelock.h> 14 15 #include "qnx6.h" 15 16 16 17 static unsigned qnx6_lfile_checksum(char *name, unsigned size) ··· 276 275 .read = generic_read_dir, 277 276 .iterate_shared = qnx6_readdir, 278 277 .fsync = generic_file_fsync, 278 + .setlease = generic_setlease, 279 279 }; 280 280 281 281 const struct inode_operations qnx6_dir_inode_operations = {
+2
fs/read_write.c
··· 20 20 #include <linux/compat.h> 21 21 #include <linux/mount.h> 22 22 #include <linux/fs.h> 23 + #include <linux/filelock.h> 23 24 #include "internal.h" 24 25 25 26 #include <linux/uaccess.h> ··· 31 30 .read_iter = generic_file_read_iter, 32 31 .mmap_prepare = generic_file_readonly_mmap_prepare, 33 32 .splice_read = filemap_splice_read, 33 + .setlease = generic_setlease, 34 34 }; 35 35 36 36 EXPORT_SYMBOL(generic_ro_fops);