[CRIU] [PATCH 07/10] restore: Kill CR_STATE_RESTORE_SHARED

Pavel Emelyanov xemul at virtuozzo.com
Fri Apr 28 05:28:55 PDT 2017


Looks like this separate stage is not needed. The scripts
involved in ns restore are synchronized with existing stages
like this:

criu:                    root task:
ROOT_TASK stage
                         <appear>
"setup-ns" script
PREPARE_NAMESPACES
                         prepare_namespace()
"post-setup-ns" script
FORKING
                         restore_task_mnt_ns()
                         <everything else>

which seems to be OK.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-restore.c       | 11 ++---------
 criu/include/restorer.h |  1 -
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index eacb371..fe1b2f8 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -129,7 +129,6 @@ static inline int stage_participants(int next_stage)
 		return 0;
 	case CR_STATE_ROOT_TASK:
 	case CR_STATE_PREPARE_NAMESPACES:
-	case CR_STATE_RESTORE_SHARED:
 		return 1;
 	case CR_STATE_FORKING:
 		return task_entries->nr_tasks + task_entries->nr_helpers;
@@ -1561,9 +1560,6 @@ static int restore_task_with_children(void *_arg)
 
 		if (root_prepare_shared())
 			goto err;
-
-		if (restore_finish_stage(task_entries, CR_STATE_RESTORE_SHARED) < 0)
-			goto err;
 	}
 
 	if (restore_task_mnt_ns(current))
@@ -1962,15 +1958,12 @@ static int restore_root_task(struct pstree_item *init)
 			goto out_kill;
 	}
 
-	timing_start(TIME_FORK);
-	ret = restore_switch_stage(CR_STATE_RESTORE_SHARED);
-	if (ret < 0)
-		goto out_kill;
-
 	ret = run_scripts(ACT_POST_SETUP_NS);
 	if (ret)
 		goto out_kill;
 
+	timing_start(TIME_FORK);
+
 	ret = restore_switch_stage(CR_STATE_FORKING);
 	if (ret < 0)
 		goto out_kill;
diff --git a/criu/include/restorer.h b/criu/include/restorer.h
index 4663339..307ee27 100644
--- a/criu/include/restorer.h
+++ b/criu/include/restorer.h
@@ -211,7 +211,6 @@ enum {
 	 * will be used to clean up remap files.
 	 */
 	CR_STATE_PREPARE_NAMESPACES,
-	CR_STATE_RESTORE_SHARED,
 	CR_STATE_FORKING,
 	CR_STATE_RESTORE,
 	CR_STATE_RESTORE_SIGCHLD,
-- 
2.1.4



More information about the CRIU mailing list