diff --git a/criu/cr-restore.c b/criu/cr-restore.c index ecb19b7a7..a84e5848c 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -957,6 +957,8 @@ static int wait_on_helpers_zombies(void) return 0; } +static int wait_exiting_children(void); + static int restore_one_zombie(CoreEntry *core) { int exit_code = core->tc->exit_code; @@ -975,7 +977,7 @@ static int restore_one_zombie(CoreEntry *core) prctl(PR_SET_NAME, (long)(void *)core->tc->comm, 0, 0, 0); if (task_entries != NULL) { - restore_finish_stage(task_entries, CR_STATE_RESTORE); + wait_exiting_children(); zombie_prepare_signals(); } @@ -1079,21 +1081,10 @@ static bool child_death_expected(void) return false; } -/* - * Restore a helper process - artificially created by criu - * to restore attributes of process tree. - * - sessions for each leaders are dead - * - process groups with dead leaders - * - dead tasks for which /proc//... is opened by restoring task - * - whatnot - */ -static int restore_one_helper(void) +static int wait_exiting_children(void) { siginfo_t info; - if (prepare_fds(current)) - return -1; - if (!child_death_expected()) { /* * Restoree has no children that should die, during restore, @@ -1136,6 +1127,22 @@ static int restore_one_helper(void) return 0; } +/* + * Restore a helper process - artificially created by criu + * to restore attributes of process tree. + * - sessions for each leaders are dead + * - process groups with dead leaders + * - dead tasks for which /proc//... is opened by restoring task + * - whatnot + */ +static int restore_one_helper(void) +{ + if (prepare_fds(current)) + return -1; + + return wait_exiting_children(); +} + static int restore_one_task(int pid, CoreEntry *core) { int i, ret;