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>
#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>
.read = generic_read_dir,
.iterate_shared = befs_readdir,
.llseek = generic_file_llseek,
+ .setlease = generic_setlease,
};
static const struct inode_operations befs_dir_inode_operations = {
#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>
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = cramfs_readdir,
+ .setlease = generic_setlease,
};
static const struct inode_operations cramfs_dir_inode_operations = {
*/
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include "efs.h"
static int efs_readdir(struct file *, struct dir_context *);
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = efs_readdir,
+ .setlease = generic_setlease,
};
const struct inode_operations efs_dir_inode_operations = {
* 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>
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = vxfs_readdir,
+ .setlease = generic_setlease,
};
* 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)
.llseek = generic_file_llseek,
.read = generic_read_dir,
.iterate_shared = isofs_readdir,
+ .setlease = generic_setlease,
};
/*
*/
#include <linux/buffer_head.h>
+#include <linux/filelock.h>
#include "qnx4.h"
static int qnx4_readdir(struct file *file, struct dir_context *ctx)
.read = generic_read_dir,
.iterate_shared = qnx4_readdir,
.fsync = generic_file_fsync,
+ .setlease = generic_setlease,
};
const struct inode_operations qnx4_dir_inode_operations =
*
*/
+#include <linux/filelock.h>
#include "qnx6.h"
static unsigned qnx6_lfile_checksum(char *name, unsigned size)
.read = generic_read_dir,
.iterate_shared = qnx6_readdir,
.fsync = generic_file_fsync,
+ .setlease = generic_setlease,
};
const struct inode_operations qnx6_dir_inode_operations = {
#include <linux/compat.h>
#include <linux/mount.h>
#include <linux/fs.h>
+#include <linux/filelock.h>
#include "internal.h"
#include <linux/uaccess.h>
.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);