linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: Luis de Bethencourt <luisbg@kernel.org>,
	Salah Triki <salah.triki@gmail.com>,
	Nicolas Pitre <nico@fluxnic.net>,
	Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
	Anders Larsen <al@alarsen.net>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
	Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>,
	Yue Hu <zbestahu@gmail.com>,
	Jeffle Xu <jefflexu@linux.alibaba.com>,
	Sandeep Dhavale <dhavale@google.com>,
	Hongbo Li <lihongbo22@huawei.com>,
	Chunhai Guo <guochunhai@vivo.com>, Jan Kara <jack@suse.com>,
	Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	David Woodhouse <dwmw2@infradead.org>,
	Richard Weinberger <richard@nod.at>,
	Dave Kleikamp <shaggy@kernel.org>,
	Ryusuke Konishi <konishi.ryusuke@gmail.com>,
	Viacheslav Dubeyko <slava@dubeyko.com>,
	Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg <martin@omnibond.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Amir Goldstein <amir73il@gmail.com>,
	Phillip Lougher <phillip@squashfs.org.uk>,
	Carlos Maiolino <cem@kernel.org>, Hugh Dickins <hughd@google.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Sungjong Seo <sj1557.seo@samsung.com>,
	Yuezhang Mo <yuezhang.mo@sony.com>,
	Chuck Lever <chuck.lever@oracle.com>,
	Alexander Aring <alex.aring@gmail.com>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dominique Martinet <asmadeus@codewreck.org>,
	Christian Schoenebeck <linux_oss@crudebyte.com>,
	Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
	Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	Steve French <sfrench@samba.org>,
	Paulo Alcantara <pc@manguebit.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
	Hans de Goede <hansg@kernel.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-btrfs@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-mtd@lists.infradead.org,
	jfs-discussion@lists.sourceforge.net,
	linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
	ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org,
	linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-mm@kvack.org, gfs2@lists.linux.dev,
	linux-doc@vger.kernel.org, v9fs@lists.linux.dev,
	ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org
Subject: Re: [PATCH 24/24] fs: remove simple_nosetlease()
Date: Wed, 25 Feb 2026 12:58:45 -0500	[thread overview]
Message-ID: <aZ84VRrRVyGEzSJn@kernel.org> (raw)
In-Reply-To: <20260108-setlease-6-20-v1-24-ea4dec9b67fa@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 3720 bytes --]

On Thu, Jan 08, 2026 at 12:13:19PM -0500, Jeff Layton wrote:
> Setting ->setlease() to a NULL pointer now has the same effect as
> setting it to simple_nosetlease(). Remove all of the setlease
> file_operations that are set to simple_nosetlease, and the function
> itself.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/9p/vfs_dir.c        |  2 --
>  fs/9p/vfs_file.c       |  2 --
>  fs/ceph/dir.c          |  2 --
>  fs/ceph/file.c         |  1 -
>  fs/fuse/dir.c          |  1 -
>  fs/gfs2/file.c         |  2 --
>  fs/libfs.c             | 18 ------------------
>  fs/nfs/dir.c           |  1 -
>  fs/nfs/file.c          |  1 -
>  fs/smb/client/cifsfs.c |  1 -
>  fs/vboxsf/dir.c        |  1 -
>  fs/vboxsf/file.c       |  1 -
>  include/linux/fs.h     |  1 -
>  13 files changed, 34 deletions(-)
> 

<snip>

> diff --git a/fs/libfs.c b/fs/libfs.c
> index 697c6d5fc12786c036f0086886297fb5cd52ae00..f1860dff86f2703266beecf31e9d2667af7a9684 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -1699,24 +1699,6 @@ struct inode *alloc_anon_inode(struct super_block *s)
>  }
>  EXPORT_SYMBOL(alloc_anon_inode);
>  
> -/**
> - * simple_nosetlease - generic helper for prohibiting leases
> - * @filp: file pointer
> - * @arg: type of lease to obtain
> - * @flp: new lease supplied for insertion
> - * @priv: private data for lm_setup operation
> - *
> - * Generic helper for filesystems that do not wish to allow leases to be set.
> - * All arguments are ignored and it just returns -EINVAL.
> - */
> -int
> -simple_nosetlease(struct file *filp, int arg, struct file_lease **flp,
> -		  void **priv)
> -{
> -	return -EINVAL;
> -}
> -EXPORT_SYMBOL(simple_nosetlease);
> -
>  /**
>   * simple_get_link - generic helper to get the target of "fast" symlinks
>   * @dentry: not used here
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index 71df279febf797880ded19e45528c3df4cea2dde..23a78a742b619dea8b76ddf28f4f59a1c8a015e2 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -66,7 +66,6 @@ const struct file_operations nfs_dir_operations = {
>  	.open		= nfs_opendir,
>  	.release	= nfs_closedir,
>  	.fsync		= nfs_fsync_dir,
> -	.setlease	= simple_nosetlease,
>  };
>  
>  const struct address_space_operations nfs_dir_aops = {
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index d020aab40c64ebda30d130b6acee1b9194621457..9d269561961825f88529551b0f0287920960ac62 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -962,7 +962,6 @@ const struct file_operations nfs_file_operations = {
>  	.splice_read	= nfs_file_splice_read,
>  	.splice_write	= iter_file_splice_write,
>  	.check_flags	= nfs_check_flags,
> -	.setlease	= simple_nosetlease,
>  	.fop_flags	= FOP_DONTCACHE,
>  };
>  EXPORT_SYMBOL_GPL(nfs_file_operations);

Hey Jeff,

I've noticed an NFS reexport regression in v6.19 and now v7.0-rc1
(similar but different due to your series that requires opt-in via
.setlease).

Bisect first pointed out this commit:
10dcd5110678 nfs: properly disallow delegation requests on directories

And now with v7.0-rc1 its the fact that NFS doesn't provide .setlease
so lstat() on parent dir (of file that I touch) gets -EINVAL.

So its a confluence of NFS's dir delegations and your setlease changes.

If I reexport NFSv4.2 filesystem in terms of NFSv4.1, the regression
is seen by doing (lstat reproducer that gemini spit out for me is
attached):

$ touch /mnt/share41/test
$ strace ./lstat /mnt/share41
...
lstat("/mnt/share41", 0x7ffec0d79920)   = -1 EINVAL (Invalid argument)

If I immediately re-run it works:
...
lstat("/mnt/share41", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0

I'm not sure what the proper fix is yet, but I feel like you've missed
that NFS itself can be (re)exported?

Thanks,
Mike

[-- Attachment #2: lstat.c --]
[-- Type: text/plain, Size: 1158 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char *argv[]) {
    // 1. Check if the filename was provided via argv
    if (argc < 2) {
        fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
        return EXIT_FAILURE;
    }

    struct stat file_stats;

    // 2. Pass the filename to the lstat syscall
    if (lstat(argv[1], &file_stats) < 0) {
        perror("lstat error");
        return EXIT_FAILURE;
    }

    // 3. Display some basic metadata
    printf("Information for: %s\n", argv[1]);
    printf("---------------------------\n");
    printf("File Size: \t\t%lld bytes\n", (long long)file_stats.st_size);
    printf("Number of Links: \t%ld\n", (long)file_stats.st_nlink);
    printf("File inode: \t\t%ld\n", (long)file_stats.st_ino);

    // 4. Determine file type using macros
    printf("File Type: \t\t");
    if (S_ISLNK(file_stats.st_mode)) printf("Symbolic Link\n");
    else if (S_ISREG(file_stats.st_mode)) printf("Regular File\n");
    else if (S_ISDIR(file_stats.st_mode)) printf("Directory\n");
    else printf("Other\n");

    return EXIT_SUCCESS;
}

  parent reply	other threads:[~2026-02-25 17:58 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 17:12 [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jeff Layton
2026-01-08 17:12 ` [PATCH 01/24] fs: add setlease to generic_ro_fops and read-only filesystem directory operations Jeff Layton
2026-01-08 17:26   ` Jan Kara
2026-01-08 17:12 ` [PATCH 02/24] affs: add setlease file operation Jeff Layton
2026-01-08 21:26   ` David Sterba
2026-01-08 17:12 ` [PATCH 03/24] btrfs: " Jeff Layton
2026-01-08 21:26   ` David Sterba
2026-01-08 17:12 ` [PATCH 04/24] erofs: " Jeff Layton
2026-01-10  1:47   ` Chao Yu
2026-01-08 17:13 ` [PATCH 05/24] ext2: " Jeff Layton
2026-01-08 17:28   ` Jan Kara
2026-01-08 17:13 ` [PATCH 06/24] ext4: " Jeff Layton
2026-01-08 17:28   ` Jan Kara
2026-01-08 17:13 ` [PATCH 07/24] exfat: " Jeff Layton
2026-01-08 22:47   ` Namjae Jeon
2026-01-08 17:13 ` [PATCH 08/24] f2fs: " Jeff Layton
2026-01-10  1:47   ` Chao Yu
2026-01-08 17:13 ` [PATCH 09/24] fat: " Jeff Layton
2026-01-08 18:12   ` OGAWA Hirofumi
2026-01-08 17:13 ` [PATCH 10/24] gfs2: add a " Jeff Layton
2026-01-08 17:13 ` [PATCH 11/24] jffs2: add " Jeff Layton
2026-01-09  8:49   ` Richard Weinberger
2026-01-08 17:13 ` [PATCH 12/24] jfs: " Jeff Layton
2026-01-08 19:46   ` Dave Kleikamp
2026-01-09  7:40   ` Richard Weinberger
2026-01-09  8:48     ` Richard Weinberger
2026-01-08 17:13 ` [PATCH 13/24] nilfs2: " Jeff Layton
2026-01-09  5:26   ` Ryusuke Konishi
2026-01-08 17:13 ` [PATCH 14/24] ntfs3: " Jeff Layton
2026-01-08 17:13 ` [PATCH 15/24] ocfs2: " Jeff Layton
2026-01-08 17:29   ` Jan Kara
2026-01-08 17:13 ` [PATCH 16/24] orangefs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 17/24] overlayfs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 18/24] squashfs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 19/24] tmpfs: " Jeff Layton
2026-01-08 17:31   ` Jan Kara
2026-01-08 17:13 ` [PATCH 20/24] udf: " Jeff Layton
2026-01-08 17:29   ` Jan Kara
2026-01-08 17:13 ` [PATCH 21/24] ufs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 22/24] xfs: " Jeff Layton
2026-01-08 17:13 ` [PATCH 23/24] filelock: default to returning -EINVAL when ->setlease operation is NULL Jeff Layton
2026-01-08 17:34   ` Jan Kara
2026-01-08 17:13 ` [PATCH 24/24] fs: remove simple_nosetlease() Jeff Layton
2026-01-08 17:34   ` Jan Kara
2026-02-25 17:58   ` Mike Snitzer [this message]
2026-01-08 17:40 ` [PATCH 00/24] vfs: require filesystems to explicitly opt-in to lease support Jan Kara
2026-01-08 18:56   ` Jeff Layton
2026-01-09  9:26     ` Jan Kara
2026-01-09 18:52     ` Amir Goldstein
2026-01-12  9:49       ` Christian Brauner
2026-01-12 13:34       ` Jeff Layton
2026-01-12 14:31         ` Chuck Lever
2026-01-12 14:50           ` Jeff Layton
2026-01-13  8:54             ` Christian Brauner
2026-01-13 11:03               ` Amir Goldstein
2026-01-13 11:45               ` Jeff Layton
2026-01-13 14:03                 ` Chuck Lever
2026-01-13 14:27                   ` Jeff Layton
2026-01-13 14:31                     ` Chuck Lever
2026-01-13 15:00                       ` Jeff Layton
2026-01-13 14:54               ` Christoph Hellwig
2026-01-13 17:06                 ` Jeff Layton
2026-01-14  6:28                   ` Christoph Hellwig
2026-01-14  9:34                     ` Amir Goldstein
2026-01-14 13:06                       ` Christoph Hellwig
2026-01-14 13:41                         ` Jeff Layton
2026-01-14 14:14                           ` Amir Goldstein
2026-01-14 14:52                             ` Chuck Lever
2026-01-14 15:05                             ` Christoph Hellwig
2026-01-15  8:18                               ` Christian Brauner
2026-01-14 15:26                           ` Christian Brauner
2026-01-14 15:20                         ` Christian Brauner
2026-01-15  6:42                           ` Christoph Hellwig
2026-01-15  8:14                             ` Christian Brauner
2026-01-15  8:33                               ` Christoph Hellwig
2026-01-14 13:39                       ` David Laight
2026-01-09  6:00 ` Christoph Hellwig
2026-01-09  8:03 ` Al Viro
2026-01-12  9:56 ` Christian Brauner
2026-02-17 21:14 ` [f2fs-dev] " patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZ84VRrRVyGEzSJn@kernel.org \
    --to=snitzer@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=agruenba@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=al@alarsen.net \
    --cc=alex.aring@gmail.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=amir73il@gmail.com \
    --cc=anna@kernel.org \
    --cc=asmadeus@codewreck.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bharathsm@microsoft.com \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chao@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=clm@fb.com \
    --cc=corbet@lwn.net \
    --cc=devel@lists.orangefs.org \
    --cc=dhavale@google.com \
    --cc=dsterba@suse.com \
    --cc=dwmw2@infradead.org \
    --cc=ericvh@kernel.org \
    --cc=gfs2@lists.linux.dev \
    --cc=guochunhai@vivo.com \
    --cc=hansg@kernel.org \
    --cc=hch@infradead.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=hubcap@omnibond.com \
    --cc=hughd@google.com \
    --cc=idryomov@gmail.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=jefflexu@linux.alibaba.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=jlayton@kernel.org \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=konishi.ryusuke@gmail.com \
    --cc=lihongbo22@huawei.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=luisbg@kernel.org \
    --cc=mark@fasheh.com \
    --cc=martin@omnibond.com \
    --cc=miklos@szeredi.hu \
    --cc=nico@fluxnic.net \
    --cc=ntfs3@lists.linux.dev \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=pc@manguebit.org \
    --cc=phillip@squashfs.org.uk \
    --cc=richard@nod.at \
    --cc=ronniesahlberg@gmail.com \
    --cc=salah.triki@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=shaggy@kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=slava@dubeyko.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    --cc=tytso@mit.edu \
    --cc=v9fs@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=xiang@kernel.org \
    --cc=xiubli@redhat.com \
    --cc=yuezhang.mo@sony.com \
    --cc=zbestahu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox