Unverified Commit 86cdbae5 authored by Christian Brauner's avatar Christian Brauner
Browse files

mnt: simplify ns_common_init() handling



Assign the reserved MNT_NS_ANON_INO sentinel to anonymous mount
namespaces and cleanup the initial mount ns allocation. This is just a
preparatory patch and the ns->inum check in ns_common_init() will be
dropped in the next patch.

Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent cc47f434
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4103,6 +4103,8 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
		return ERR_PTR(-ENOMEM);
	}

	if (anon)
		new_ns->ns.inum = MNT_NS_ANON_INO;
	ret = ns_common_init(&new_ns->ns, &mntns_operations, !anon);
	if (ret) {
		kfree(new_ns);
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
int ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops,
		   bool alloc_inum)
{
	if (alloc_inum) {
	if (alloc_inum && !ns->inum) {
		int ret;
		ret = proc_alloc_inum(&ns->inum);
		if (ret)