2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 14:55:39 +00:00

mnt: Move nsmask checking into prepare_mnt_ns

Helper for simpler next patch.

Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2014-04-22 20:38:54 +04:00
parent 908915889d
commit 05c02ddcf9
2 changed files with 9 additions and 2 deletions

View File

@@ -1710,6 +1710,9 @@ int prepare_mnt_ns(void)
struct mount_info *mis, *old; struct mount_info *mis, *old;
struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc }; struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc };
if (!(root_ns_mask & CLONE_NEWNS))
return 0;
pr_info("Restoring mount namespace\n"); pr_info("Restoring mount namespace\n");
old = collect_mntinfo(&ns); old = collect_mntinfo(&ns);

View File

@@ -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; id = ns_per_id ? item->ids->ipc_ns_id : pid;
if ((clone_flags & CLONE_NEWIPC) && prepare_ipc_ns(id)) if ((clone_flags & CLONE_NEWIPC) && prepare_ipc_ns(id))
return -1; 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 -1;
return 0; return 0;