lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260108-setlease-6-20-v1-1-ea4dec9b67fa@kernel.org>
Date: Thu, 08 Jan 2026 12:12:56 -0500
From: Jeff Layton <jlayton@...nel.org>
To: Luis de Bethencourt <luisbg@...nel.org>, 
 Salah Triki <salah.triki@...il.com>, Nicolas Pitre <nico@...xnic.net>, 
 Christoph Hellwig <hch@...radead.org>, Jan Kara <jack@...e.cz>, 
 Anders Larsen <al@...rsen.net>, Alexander Viro <viro@...iv.linux.org.uk>, 
 Christian Brauner <brauner@...nel.org>, David Sterba <dsterba@...e.com>, 
 Chris Mason <clm@...com>, Gao Xiang <xiang@...nel.org>, 
 Chao Yu <chao@...nel.org>, Yue Hu <zbestahu@...il.com>, 
 Jeffle Xu <jefflexu@...ux.alibaba.com>, 
 Sandeep Dhavale <dhavale@...gle.com>, Hongbo Li <lihongbo22@...wei.com>, 
 Chunhai Guo <guochunhai@...o.com>, Jan Kara <jack@...e.com>, 
 Theodore Ts'o <tytso@....edu>, Andreas Dilger <adilger.kernel@...ger.ca>, 
 Jaegeuk Kim <jaegeuk@...nel.org>, 
 OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>, 
 David Woodhouse <dwmw2@...radead.org>, Richard Weinberger <richard@....at>, 
 Dave Kleikamp <shaggy@...nel.org>, 
 Ryusuke Konishi <konishi.ryusuke@...il.com>, 
 Viacheslav Dubeyko <slava@...eyko.com>, 
 Konstantin Komarov <almaz.alexandrovich@...agon-software.com>, 
 Mark Fasheh <mark@...heh.com>, Joel Becker <jlbec@...lplan.org>, 
 Joseph Qi <joseph.qi@...ux.alibaba.com>, 
 Mike Marshall <hubcap@...ibond.com>, 
 Martin Brandenburg <martin@...ibond.com>, 
 Miklos Szeredi <miklos@...redi.hu>, Amir Goldstein <amir73il@...il.com>, 
 Phillip Lougher <phillip@...ashfs.org.uk>, Carlos Maiolino <cem@...nel.org>, 
 Hugh Dickins <hughd@...gle.com>, 
 Baolin Wang <baolin.wang@...ux.alibaba.com>, 
 Andrew Morton <akpm@...ux-foundation.org>, 
 Namjae Jeon <linkinjeon@...nel.org>, Sungjong Seo <sj1557.seo@...sung.com>, 
 Yuezhang Mo <yuezhang.mo@...y.com>, Chuck Lever <chuck.lever@...cle.com>, 
 Alexander Aring <alex.aring@...il.com>, 
 Andreas Gruenbacher <agruenba@...hat.com>, Jonathan Corbet <corbet@....net>, 
 "Matthew Wilcox (Oracle)" <willy@...radead.org>, 
 Eric Van Hensbergen <ericvh@...nel.org>, 
 Latchesar Ionkov <lucho@...kov.net>, 
 Dominique Martinet <asmadeus@...ewreck.org>, 
 Christian Schoenebeck <linux_oss@...debyte.com>, 
 Xiubo Li <xiubli@...hat.com>, Ilya Dryomov <idryomov@...il.com>, 
 Trond Myklebust <trondmy@...nel.org>, Anna Schumaker <anna@...nel.org>, 
 Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.org>, 
 Ronnie Sahlberg <ronniesahlberg@...il.com>, 
 Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>, 
 Bharath SM <bharathsm@...rosoft.com>, Hans de Goede <hansg@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org, 
 linux-btrfs@...r.kernel.org, linux-erofs@...ts.ozlabs.org, 
 linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net, 
 linux-mtd@...ts.infradead.org, jfs-discussion@...ts.sourceforge.net, 
 linux-nilfs@...r.kernel.org, ntfs3@...ts.linux.dev, 
 ocfs2-devel@...ts.linux.dev, devel@...ts.orangefs.org, 
 linux-unionfs@...r.kernel.org, linux-xfs@...r.kernel.org, 
 linux-mm@...ck.org, gfs2@...ts.linux.dev, linux-doc@...r.kernel.org, 
 v9fs@...ts.linux.dev, ceph-devel@...r.kernel.org, linux-nfs@...r.kernel.org, 
 linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org, 
 Jeff Layton <jlayton@...nel.org>
Subject: [PATCH 01/24] 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@...nel.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ