Commit e0b8f914 authored by Pavel Emelyanov's avatar Pavel Emelyanov

rst: Make clean error path for root task restore

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 44a85ee0
......@@ -1354,15 +1354,27 @@ static int restore_root_task(struct pstree_item *init)
ret = restore_switch_stage(CR_STATE_RESTORE_CREDS);
BUG_ON(ret);
out:
if (ret < 0) {
struct pstree_item *pi;
timing_stop(TIME_RESTORE);
pr_info("Restore finished successfully. Resuming tasks.\n");
futex_set_and_wake(&task_entries->start, CR_STATE_COMPLETE);
write_stats(RESTORE_STATS);
if (!opts.restore_detach)
wait(NULL);
return 0;
out:
if (current_ns_mask & CLONE_NEWPID) {
/* Kill init */
if (root_item->pid.real > 0)
kill(root_item->pid.real, SIGKILL);
} else {
struct pstree_item *pi;
for_each_pstree_item(pi)
if (pi->pid.virt > 0)
kill(pi->pid.virt, SIGKILL);
......@@ -1370,18 +1382,6 @@ out:
pr_err("Restoring FAILED.\n");
return 1;
}
timing_stop(TIME_RESTORE);
pr_info("Restore finished successfully. Resuming tasks.\n");
futex_set_and_wake(&task_entries->start, CR_STATE_COMPLETE);
write_stats(RESTORE_STATS);
if (!opts.restore_detach)
wait(NULL);
return 0;
}
static int prepare_task_entries()
......
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