]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ntfs3: add setlease file operation
authorJeff Layton <jlayton@kernel.org>
Thu, 8 Jan 2026 17:13:09 +0000 (12:13 -0500)
committerChristian Brauner <brauner@kernel.org>
Mon, 12 Jan 2026 09:55:47 +0000 (10:55 +0100)
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>
Link: https://patch.msgid.link/20260108-setlease-6-20-v1-14-ea4dec9b67fa@kernel.org
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/ntfs3/dir.c
fs/ntfs3/file.c

index b98e95d6b4d993db114283a0f38cf10b1a7520a9..b66438e34bbb84483c5e6a5dde437251339d4335 100644 (file)
@@ -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
index 2e7b2e566ebe18c173319c7cfd4304c22ddd2f28..6cb4479072a66dc9c3429be1c4bcebce176e5913 100644 (file)
@@ -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