[PATCH 00/13] vfs: recall-only directory delegations for knfsd
From: Jeff Layton <jlayton@kernel.org>
Date: 2025-10-13 14:48:16
Also in:
linux-cifs, linux-fsdevel, linux-nfs, linux-unionfs, linux-xfs, lkml, netfs
At the fall NFS Bakeathon last week, the NFS client and server maintainers had a discussion about how to merge support for directory delegations. We decided to start with just merging support for simple, recallable-only directory delegation support, for a number of reasons: 1/ RFC8881 has some gaps in coverage that we are hoping to have addressed in RFC8881bis. In particular, it's written such that CB_NOTIFY callbacks require directory position information. That will be hard to do properly under Linux, so we're planning to extend the spec to allow that information to be omitted. 2/ client-side support for CB_NOTIFY still lags a bit. The client side is tricky, as it involves heuristics about when to request a delegation. 3/ we have some early indication that simple, recallable-only delegations can help performance in some cases. Anna mentioned seeing a multi-minute speedup in xfstests runs with them enabled. This needs more investigation, but it's promising and seems like enough justification to merge support. This patchset is quite similar to the set I initially posted back in early 2024 [1]. We've merged some GET_DIR_DELEGATION handling patches since then, but the VFS layer support is basically the same. One thing that I want to make clear is that with this patchset, userspace can request a read lease on a directory that will be recalled on conflicting accesses. I saw no reason to prevent this, and I think it may be something useful for applications like Samba. As always, users can disable leases altogether via the fs.leases-enable sysctl if this is an issue, but I wanted to point this out in case anyone sees footguns here. It would be great if we could get into linux-next soon so that it can be merged for v6.19. Christian, could you pick up the vfs/filelock patches, and Chuck pick up the nfsd patches? Thanks! [1]: https://lore.kernel.org/all/20240315-dir-deleg-v1-0-a1d6209a3654@kernel.org/ (local) Signed-off-by: Jeff Layton <jlayton@kernel.org> --- Jeff Layton (13): filelock: push the S_ISREG check down to ->setlease handlers filelock: add a lm_may_setlease lease_manager callback vfs: add try_break_deleg calls for parents to vfs_{link,rename,unlink} vfs: allow mkdir to wait for delegation break on parent vfs: allow rmdir to wait for delegation break on parent vfs: break parent dir delegations in open(..., O_CREAT) codepath vfs: make vfs_create break delegations on parent directory vfs: make vfs_mknod break delegations on parent directory filelock: lift the ban on directory leases in generic_setlease nfsd: allow filecache to hold S_IFDIR files nfsd: allow DELEGRETURN on directories nfsd: check for delegation conflicts vs. the same client nfsd: wire up GET_DIR_DELEGATION handling drivers/base/devtmpfs.c | 6 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 6 +- fs/fuse/dir.c | 1 + fs/init.c | 4 +- fs/locks.c | 17 ++++- fs/namei.c | 163 ++++++++++++++++++++++++++++++++++------------- fs/nfs/nfs4file.c | 2 + fs/nfsd/filecache.c | 50 +++++++++++---- fs/nfsd/filecache.h | 2 + fs/nfsd/nfs4proc.c | 21 +++++- fs/nfsd/nfs4recover.c | 6 +- fs/nfsd/nfs4state.c | 114 ++++++++++++++++++++++++++++++++- fs/nfsd/state.h | 5 ++ fs/nfsd/vfs.c | 11 ++-- fs/nfsd/vfs.h | 2 +- fs/overlayfs/overlayfs.h | 6 +- fs/smb/client/cifsfs.c | 3 + fs/smb/server/vfs.c | 6 +- fs/xfs/scrub/orphanage.c | 2 +- include/linux/filelock.h | 14 ++++ include/linux/fs.h | 9 +-- net/unix/af_unix.c | 2 +- 23 files changed, 363 insertions(+), 91 deletions(-) --- base-commit: 2c40814eb5ae104d3f898fd8b705ecad114105b5 change-id: 20251013-dir-deleg-ro-d0fe19823b21 Best regards, -- Jeff Layton [off-list ref]