]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
do_add_mount(): switch to passing pinned_mountpoint instead of mountpoint + path
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 20 Aug 2025 01:21:24 +0000 (21:21 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 16 Sep 2025 01:26:05 +0000 (21:26 -0400)
commitef307f89bfb662109a25acdde5b5837fe84a3a64
tree6c05cbcfad15d6c9af70fadd89a15cf33bfc9565
parent842e12352c3074b8af1bc95cc2bb1e9fb47f4334
do_add_mount(): switch to passing pinned_mountpoint instead of mountpoint + path

Both callers pass it a mountpoint reference picked from pinned_mountpoint
and path it corresponds to.

First of all, path->dentry is equal to mp.mp->m_dentry.  Furthermore, path->mnt
is &mp.parent->mnt, making struct path contents redundant.

Pass it the address of that pinned_mountpoint instead; what's more, if we
teach it to treat ERR_PTR(error) in ->parent as "bail out with that error"
we can simplify the callers even more - do_add_mount() will do the right
thing even when called after lock_mount() failure.

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c