[CRIU] [PATCH] scripts: Add ACT_POST_SIGRETURN stage

Cyrill Gorcunov gorcunov at gmail.com
Mon Jan 9 06:44:57 PST 2017


The "post-sigreturn" action is when all tasks are restored
but not yet restarted sitting in frozen/seized state, right
after final rt-sigreturn call passed.

In vz7 this step is needed to tune up beancounters/cgroups
params from the script, in vanilla criu it useful as well.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/action-scripts.c         | 1 +
 criu/cr-restore.c             | 4 ++++
 criu/include/action-scripts.h | 1 +
 3 files changed, 6 insertions(+)

diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index 6a47d5e..d13de23 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -26,6 +26,7 @@ static const char *action_names[ACT_MAX] = {
 	[ ACT_POST_SETUP_NS ]	= "post-setup-namespaces",
 	[ ACT_POST_RESUME ]	= "post-resume",
 	[ ACT_POST_NET_LOCK ]	= "post-network-lock",
+	[ ACT_POST_SIGRETURN ]	= "post-sigreturn",
 };
 
 struct script {
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index d003f12..da6ed31 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1852,6 +1852,10 @@ static int restore_root_task(struct pstree_item *init)
 	if (ret == 0)
 		finalize_restore();
 
+	ret = run_scripts(ACT_POST_SIGRETURN);
+	if (ret)
+		pr_err("Post-sigreturn script ret code %d\n", ret);
+
 	if (restore_freezer_state())
 		pr_err("Unable to restore freezer state\n");
 
diff --git a/criu/include/action-scripts.h b/criu/include/action-scripts.h
index e49f57c..631350d 100644
--- a/criu/include/action-scripts.h
+++ b/criu/include/action-scripts.h
@@ -12,6 +12,7 @@ enum script_actions {
 	ACT_POST_SETUP_NS,
 	ACT_POST_RESUME,
 	ACT_POST_NET_LOCK,
+	ACT_POST_SIGRETURN,
 
 	ACT_MAX
 };
-- 
2.7.4



More information about the CRIU mailing list