[CRIU] [PATCH 06/21] restore: Make error path in restore_root_task() accurate
Kirill Tkhai
ktkhai at virtuozzo.com
Tue May 23 05:39:03 PDT 2017
Don't call destroy_pid_ns_helpers() twice; add a new case
for that.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/cr-restore.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 446583332..238b05b18 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -2100,7 +2100,7 @@ static int restore_root_task(struct pstree_item *init)
if (ptrace(PTRACE_SEIZE, init->pid->real, 0, 0)) {
pr_perror("Can't attach to init");
- goto out_kill;
+ goto out_destroy;
}
}
@@ -2112,25 +2112,25 @@ static int restore_root_task(struct pstree_item *init)
* prepare_userns_creds() must be called after filling mappings.
*/
if ((root_ns_mask & CLONE_NEWUSER) && prepare_userns(init->pid->real, userns_entry))
- goto out_kill;
+ goto out_destroy;
pr_info("Wait until namespaces are created\n");
ret = restore_wait_inprogress_tasks();
if (ret)
- goto out_kill;
+ goto out_destroy;
ret = run_scripts(ACT_SETUP_NS);
if (ret)
- goto out_kill;
+ goto out_destroy;
ret = restore_switch_stage(CR_STATE_PREPARE_NAMESPACES);
if (ret)
- goto out_kill;
+ goto out_destroy;
if (root_ns_mask & CLONE_NEWNS) {
mnt_ns_fd = open_proc(init->pid->real, "ns/mnt");
if (mnt_ns_fd < 0)
- goto out_kill;
+ goto out_destroy;
}
if (opts.empty_ns & CLONE_NEWNET) {
@@ -2143,12 +2143,12 @@ static int restore_root_task(struct pstree_item *init)
*/
ret = network_lock_internal();
if (ret)
- goto out_kill;
+ goto out_destroy;
}
ret = run_scripts(ACT_POST_SETUP_NS);
if (ret)
- goto out_kill;
+ goto out_destroy;
__restore_switch_stage(CR_STATE_FORKING);
@@ -2156,7 +2156,7 @@ static int restore_root_task(struct pstree_item *init)
ret = restore_wait_inprogress_tasks();
if (ret < 0)
- goto out_kill;
+ goto out_destroy;
/*
* Zombies die after CR_STATE_RESTORE which is switched
@@ -2273,9 +2273,9 @@ static int restore_root_task(struct pstree_item *init)
wait(NULL);
return 0;
-
-out_kill:
+out_destroy:
destroy_pid_ns_helpers();
+out_kill:
/*
* The processes can be killed only when all of them have been created,
* otherwise an external proccesses can be killed.
More information about the CRIU
mailing list