[CRIU] [PATCH 09/13] mounts: create a temporary directory for restoring non-root mntns
Andrey Vagin
avagin at openvz.org
Tue Apr 8 17:13:37 PDT 2014
All non-root namespaces will be restored as sub-trees of the root tree.
This patch creates a temporary directory and mount tmpfs in it, then
create directories for each non-root mount namespace.
tmpfs is quite useful here to simplify destroying this construction,
we don't need to unmount each namespace separately.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-restore.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index 0895c1c..2611bb5 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1256,10 +1256,10 @@ static int restore_task_with_children(void *_arg)
* Thus -- mount proc at custom location for any new namespace
*/
if (mount_proc())
- exit(1);
+ goto err;
if (root_prepare_shared())
- exit(1);
+ goto err;
}
/*
@@ -1272,27 +1272,35 @@ static int restore_task_with_children(void *_arg)
ret = sigprocmask(SIG_BLOCK, &blockmask, NULL);
if (ret) {
pr_perror("%d: Can't block signals", current->pid.virt);
- exit(1);
+ goto err;
}
if (prepare_mappings(pid))
- exit(1);
+ goto err;
if (create_children_and_session())
- exit(1);
+ goto err;
if (unmap_guard_pages())
- exit(1);
+ goto err;
restore_pgid();
if (restore_finish_stage(CR_STATE_FORKING) < 0)
- exit(1);
+ goto err;
+
+ if (current->parent == NULL && fini_mnt_ns())
+ exit (1);
if (current->state == TASK_HELPER)
return 0;
return restore_one_task(current->pid.virt, ca->core);
+err:
+ if (current->parent == NULL)
+ fini_mnt_ns();
+
+ exit(1);
}
static inline int stage_participants(int next_stage)
--
1.8.5.3
More information about the CRIU
mailing list