diff --git a/criu/cr-dump.c b/criu/cr-dump.c index 1bc5d934f..302078caa 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -2192,6 +2192,9 @@ int cr_dump_tasks(pid_t pid) if (collect_pstree()) goto err; + if (checkpoint_devices()) + goto err; + if (collect_pstree_ids()) goto err; diff --git a/criu/include/seize.h b/criu/include/seize.h index 64e8d2d12..fc7facad3 100644 --- a/criu/include/seize.h +++ b/criu/include/seize.h @@ -2,6 +2,7 @@ #define __CR_SEIZE_H__ extern int collect_pstree(void); +extern int checkpoint_devices(void); struct pstree_item; extern void pstree_switch_state(struct pstree_item *root_item, int st); extern const char *get_real_freezer_state(void); diff --git a/criu/seize.c b/criu/seize.c index 007e8e580..f56357ac7 100644 --- a/criu/seize.c +++ b/criu/seize.c @@ -1050,7 +1050,6 @@ int collect_pstree(void) pid_t pid = root_item->pid->real; int ret, exit_code = -1; struct proc_status_creds creds; - struct pstree_item *iter; timing_start(TIME_FREEZING); @@ -1111,14 +1110,6 @@ int collect_pstree(void) goto err; } - for_each_pstree_item(iter) { - if (!task_alive(iter)) - continue; - ret = run_plugins(CHECKPOINT_DEVICES, iter->pid->real); - if (ret < 0 && ret != -ENOTSUP) - goto err; - } - exit_code = 0; timing_stop(TIME_FREEZING); timing_start(TIME_FROZEN); @@ -1128,3 +1119,21 @@ err: alarm(0); return exit_code; } + +int checkpoint_devices(void) +{ + struct pstree_item *iter; + int ret, exit_code = -1; + + for_each_pstree_item(iter) { + if (!task_alive(iter)) + continue; + ret = run_plugins(CHECKPOINT_DEVICES, iter->pid->real); + if (ret < 0 && ret != -ENOTSUP) + goto err; + } + + exit_code = 0; +err: + return exit_code; +} \ No newline at end of file