[CRIU] [PATCH 1/3] cr-restore: "post-resume" hook introduced

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Wed Apr 6 02:01:48 PDT 2016


This hook is called at the very end, when everything is restored and processes
were resumed.
Can be used for some actions, which require operation container, like
restarting of systemd autofs services.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/action-scripts.c         |    1 +
 criu/cr-restore.c             |    4 ++++
 criu/include/action-scripts.h |    1 +
 criu/mount.c                  |    1 +
 4 files changed, 7 insertions(+)

diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index 05aa9d0..b1f7952 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -20,6 +20,7 @@ static const char *action_names[ACT_MAX] = {
 	[ ACT_NET_UNLOCK ]	= "network-unlock",
 	[ ACT_SETUP_NS ]	= "setup-namespaces",
 	[ ACT_POST_SETUP_NS ]	= "post-setup-namespaces",
+	[ ACT_POST_RESUME ]	= "post-resume",
 };
 
 int run_scripts(enum script_actions act)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 0720c07..2b11b71 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -2198,6 +2198,10 @@ static int restore_root_task(struct pstree_item *init)
 	if (!opts.restore_detach && !opts.exec_cmd)
 		wait(NULL);
 
+	ret = run_scripts(ACT_POST_RESUME);
+	if (ret != 0)
+		pr_err("Post-resume script ret code %d\n", ret);
+
 	return 0;
 
 out_kill:
diff --git a/criu/include/action-scripts.h b/criu/include/action-scripts.h
index 8ffc2c5..4ab5d6d 100644
--- a/criu/include/action-scripts.h
+++ b/criu/include/action-scripts.h
@@ -18,6 +18,7 @@ enum script_actions {
 	ACT_NET_UNLOCK		= 5,
 	ACT_SETUP_NS		= 6,
 	ACT_POST_SETUP_NS	= 7,
+	ACT_POST_RESUME		= 8,
 
 	ACT_MAX
 };
diff --git a/criu/mount.c b/criu/mount.c
index 7b698cf..5cb26ce 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2483,6 +2483,7 @@ do_bind:
 
 	if (mount(root, mi->mountpoint, NULL, MS_BIND, NULL) < 0) {
 		pr_perror("Can't mount at %s", mi->mountpoint);
+		sleep(1000);
 		goto err;
 	}
 



More information about the CRIU mailing list