cachefiles: Use lookup_one() rather than lookup_one_len()
authorNeilBrown <neilb@suse.de>
Wed, 19 Mar 2025 03:01:34 +0000 (14:01 +1100)
committerChristian Brauner <brauner@kernel.org>
Mon, 7 Apr 2025 07:25:32 +0000 (09:25 +0200)
commit2011067c6477b55ef510e4ef830bca2869cd8136
tree4313ab813b39d6af36fb63ce9273ca2d1a26594a
parent8ad9248471138e08a91d5e54b74d95d02f9518b2
cachefiles: Use lookup_one() rather than lookup_one_len()

cachefiles uses some VFS interfaces (such as vfs_mkdir) which take an
explicit mnt_idmap, and it passes &nop_mnt_idmap as cachefiles doesn't
yet support idmapped mounts.

It also uses the lookup_one_len() family of functions which implicitly
use &nop_mnt_idmap.  This mixture of implicit and explicit could be
confusing.  When we eventually update cachefiles to support idmap mounts it
would be best if all places which need an idmap determined from the
mount point were similar and easily found.

So this patch changes cachefiles to use lookup_one(), lookup_one_unlocked(),
and lookup_one_positive_unlocked(), passing &nop_mnt_idmap.

This has the benefit of removing the remaining user of the
lookup_one_len functions where permission checking is actually needed.
Other callers don't care about permission checking and using these
function only where permission checking is needed is a valuable
simplification.

This requires passing the name in a qstr.  This is easily done with
QSTR() as the name is always nul terminated, and often strlen is used
anyway.  ->d_name_len is removed as no longer useful.

Signed-off-by: NeilBrown <neilb@suse.de>
Link: https://lore.kernel.org/r/20250319031545.2999807-4-neil@brown.name
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/cachefiles/internal.h
fs/cachefiles/key.c
fs/cachefiles/namei.c