Skip to contentSkip to conversation

vfs lookup_{noperm,one}() cleanup

GIT PULL Merged Christian Brauner 2 participants 2 messages May 23, 2025 – May 26, 2025 VFS

lore
Share & tools
lore

Christian Brauner

author maintainer
#0 lore raw

Hey Linus,

/* Summary */

This contains cleanups for the lookup_one*() family of helpers.

We expose a set of functions with names containing "lookup_one_len" and others without the "_len". This difference has nothing to do with "len". It's rater a historical accident that can be confusing.

The functions without "_len" take a "mnt_idmap" pointer. This is found in the "vfsmount" and that is an important question when choosing which to use: do you have a vfsmount, or are you "inside" the filesystem. A related question is "is permission checking relevant here?".

nfsd and cachefiles *do* have a vfsmount but *don't* use the non-_len functions. They pass nop_mnt_idmap and refuse to work on filesystems which have any other idmap.

This work changes nfsd and cachefile to use the lookup_one family of functions and to explictily pass &nop_mnt_idmap which is consistent with all other vfs interfaces used where &nop_mnt_idmap is explicitly passed.

The remaining uses of the "_one" functions do not require permission checks so these are renamed to be "_noperm" and the permission checking is removed.

This series also changes these lookup function to take a qstr instead of separate name and len. In many cases this simplifies the call.

/* Testing */

gcc (Debian 14.2.0-19) 14.2.0
Debian clang version 19.1.7 (3)

No build failures or warnings were observed.

/* Conflicts */

Merge conflicts with mainline
=============================

No known conflicts.

Merge conflicts with other trees
================================

No known conflicts.

The following changes since commit 0af2f6be1b4281385b618cb86ad946eded089ac8:

Linux 6.15-rc1 (2025-04-06 13:11:33 -0700)

are available in the Git repository at:

[email protected]:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.16-rc1.async.dir

for you to fetch changes up to 4e5c53e03806359e68dde5e951e50cd1f4908405:

Merge patch series "VFS: improve interface for lookup_one functions" (2025-04-08 11:24:42 +0200)

Please consider pulling these changes from the signed vfs-6.16-rc1.async.dir tag.

Thanks!
Christian

----------------------------------------------------------------
vfs-6.16-rc1.async.dir

----------------------------------------------------------------
Christian Brauner (1):
Merge patch series "VFS: improve interface for lookup_one functions"

NeilBrown (6):
VFS: improve interface for lookup_one functions
nfsd: Use lookup_one() rather than lookup_one_len()
cachefiles: Use lookup_one() rather than lookup_one_len()
VFS: rename lookup_one_len family to lookup_noperm and remove permission check Use try_lookup_noperm() instead of d_hash_and_lookup() outside of VFS
VFS: change lookup_one_common and lookup_noperm_common to take a qstr

 Documentation/filesystems/porting.rst |  40 +++++++++
 arch/s390/hypfs/inode.c               |   2 +-
 drivers/android/binderfs.c            |   4 +-
 drivers/infiniband/hw/qib/qib_fs.c    |   4 +-
 fs/afs/dir.c                          |   2 +-
 fs/afs/dir_silly.c                    |   6 +-
 fs/autofs/dev-ioctl.c                 |   3 +-
 fs/binfmt_misc.c                      |   2 +-
 fs/btrfs/ioctl.c                      |   9 +-
 fs/cachefiles/internal.h              |   1 -
 fs/cachefiles/key.c                   |   1 -
 fs/cachefiles/namei.c                 |  14 +--
 fs/dcache.c                           |   1 -
 fs/debugfs/inode.c                    |   6 +-
 fs/ecryptfs/inode.c                   |  16 ++--
 fs/efivarfs/super.c                   |  15 ++--
 fs/exportfs/expfs.c                   |   5 +-
 fs/internal.h                         |   1 +
 fs/kernfs/mount.c                     |   2 +-
 fs/namei.c                            | 156 +++++++++++++++++-----------------
 fs/nfs/unlink.c                       |  11 ++-
 fs/nfsd/nfs3proc.c                    |   4 +-
 fs/nfsd/nfs3xdr.c                     |   4 +-
 fs/nfsd/nfs4proc.c                    |   4 +-
 fs/nfsd/nfs4recover.c                 |  13 +--
 fs/nfsd/nfs4xdr.c                     |   4 +-
 fs/nfsd/nfsproc.c                     |   5 +-
 fs/nfsd/vfs.c                         |  17 ++--
 fs/overlayfs/export.c                 |   6 +-
 fs/overlayfs/namei.c                  |  14 +--
 fs/overlayfs/overlayfs.h              |   2 +-
 fs/overlayfs/readdir.c                |   9 +-
 fs/proc/base.c                        |   2 +-
 fs/quota/dquot.c                      |   2 +-
 fs/smb/client/cached_dir.c            |   5 +-
 fs/smb/client/cifsfs.c                |   3 +-
 fs/smb/client/readdir.c               |   3 +-
 fs/smb/server/smb2pdu.c               |   7 +-
 fs/tracefs/inode.c                    |   2 +-
 fs/xfs/scrub/orphanage.c              |   7 +-
 include/linux/dcache.h                |   4 +-
 include/linux/namei.h                 |  17 ++--
 ipc/mqueue.c                          |   5 +-
 kernel/bpf/inode.c                    |   2 +-
 net/sunrpc/rpc_pipe.c                 |  12 +--
 security/apparmor/apparmorfs.c        |   4 +-
 security/inode.c                      |   2 +-
 security/selinux/selinuxfs.c          |   4 +-
 48 files changed, 254 insertions(+), 210 deletions(-)
merge bot Merged
#1 lore raw
The pull request you sent on Fri, 23 May 2025 14:36:59 +0200:

The pull request you sent on Fri, 23 May 2025 14:36:59 +0200:

Quoted 1 line

[email protected]:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.16-rc1.async.dir

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/6d5b940e1e14fcc20b5a3536647fe3c41b07d4f5

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html