Commit 05c02ddc authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Move nsmask checking into prepare_mnt_ns

Helper for simpler next patch.
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 90891588
......@@ -1710,6 +1710,9 @@ int prepare_mnt_ns(void)
struct mount_info *mis, *old;
struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc };
if (!(root_ns_mask & CLONE_NEWNS))
return 0;
pr_info("Restoring mount namespace\n");
old = collect_mntinfo(&ns);
......
......@@ -526,8 +526,12 @@ int prepare_namespace(struct pstree_item *item, unsigned long clone_flags)
id = ns_per_id ? item->ids->ipc_ns_id : pid;
if ((clone_flags & CLONE_NEWIPC) && prepare_ipc_ns(id))
return -1;
id = ns_per_id ? item->ids->mnt_ns_id : pid;
if ((clone_flags & CLONE_NEWNS) && prepare_mnt_ns())
/*
* This one is special -- there can be several mount
* namespaces and prepare_mnt_ns handles them itself.
*/
if (prepare_mnt_ns())
return -1;
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment