]> Gentwo Git Trees - linux/.git/commit
setup_mnt(): primitive for connecting a mount to filesystem
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 5 Jul 2025 04:38:09 +0000 (00:38 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 17 Sep 2025 19:58:28 +0000 (15:58 -0400)
commit5d132cfafb6a86740e65177c79fd5d7b02613383
tree6ad27d1760753189f2c2b9a7f92daf007b0b95b2
parent7f954a6f491088f18a6c7c975da8ddc8c003e518
setup_mnt(): primitive for connecting a mount to filesystem

Take the identical logics in vfs_create_mount() and clone_mnt() into
a new helper that takes an empty struct mount and attaches it to
given dentry (sub)tree.

Should be called once in the lifetime of every mount, prior to making
it visible in any data structures.

After that point ->mnt_root and ->mnt_sb never change; ->mnt_root
is a counting reference to dentry and ->mnt_sb - an active reference
to superblock.

Mount remains associated with that dentry tree all the way until
the call of cleanup_mnt(), when the refcount eventually drops
to zero.

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