new predicate: anon_ns_root(mount)
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 9 Jun 2025 03:25:36 +0000 (23:25 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 29 Jun 2025 22:13:41 +0000 (18:13 -0400)
commit05da054d43770e229dfb0e185c15452eed14364c
treee99c8dd4d3e780ffe309be758bb5c53356f05c00
parente031251cb249f824ad67cb0b2fc18b68d5792b8d
new predicate: anon_ns_root(mount)

checks if mount is the root of an anonymouns namespace.
Switch open-coded equivalents to using it.

For mounts that belong to anon namespace !mnt_has_parent(mount)
is the same as mount == ns->root, and intent is more obvious in
the latter form.

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