mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
rstore: Invert switch_restore_stage logic
Currentl it waits for previous stage to complete and starts the next one. Now it starts the next one and waits for it to complete. The latter way fits better into both -- the code and the head. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
9b45833b81
commit
e5534e8e3a
27
cr-restore.c
27
cr-restore.c
@ -1255,15 +1255,8 @@ static void __restore_switch_stage(int next_stage)
|
|||||||
|
|
||||||
static int restore_switch_stage(int next_stage)
|
static int restore_switch_stage(int next_stage)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = restore_wait_inprogress_tasks();
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
__restore_switch_stage(next_stage);
|
__restore_switch_stage(next_stage);
|
||||||
|
return restore_wait_inprogress_tasks();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int restore_root_task(struct pstree_item *init)
|
static int restore_root_task(struct pstree_item *init)
|
||||||
@ -1326,32 +1319,24 @@ static int restore_root_task(struct pstree_item *init)
|
|||||||
|
|
||||||
timing_start(TIME_FORK);
|
timing_start(TIME_FORK);
|
||||||
|
|
||||||
__restore_switch_stage(CR_STATE_FORKING);
|
ret = restore_switch_stage(CR_STATE_FORKING);
|
||||||
|
if (ret < 0)
|
||||||
pr_info("Wait until all tasks are forked\n");
|
|
||||||
ret = restore_wait_inprogress_tasks();
|
|
||||||
if (ret)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
timing_stop(TIME_FORK);
|
timing_stop(TIME_FORK);
|
||||||
|
|
||||||
__restore_switch_stage(CR_STATE_RESTORE_PGID);
|
ret = restore_switch_stage(CR_STATE_RESTORE_PGID);
|
||||||
|
if (ret < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
pr_info("Wait until all tasks restored pgid\n");
|
|
||||||
ret = restore_switch_stage(CR_STATE_RESTORE);
|
ret = restore_switch_stage(CR_STATE_RESTORE);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
pr_info("Wait until all tasks restored sigchld handlers\n");
|
|
||||||
ret = restore_switch_stage(CR_STATE_RESTORE_SIGCHLD);
|
ret = restore_switch_stage(CR_STATE_RESTORE_SIGCHLD);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
pr_info("Wait until all tasks are restored\n");
|
|
||||||
ret = restore_wait_inprogress_tasks();
|
|
||||||
if (ret < 0)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* Restore SIGCHLD here to skip SIGCHLD from a network sctip */
|
/* Restore SIGCHLD here to skip SIGCHLD from a network sctip */
|
||||||
ret = sigaction(SIGCHLD, &old_act, NULL);
|
ret = sigaction(SIGCHLD, &old_act, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user