[CRIU] [PATCH 1/2] finalize cgroups correctly

Tycho Andersen tycho.andersen at canonical.com
Thu Mar 19 07:50:55 PDT 2015


We need to finalize the cg yard both on successful cgroup restore and on a
failed restore. Further, we should restore the cgroup properties before
allowing the task to continue in all modes (previously properties were only
restored correctly in --restore-detached mode).

CC: Saied Kazemi <saied at google.com>
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 cr-restore.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 4a1fe4e..8d82945 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1798,6 +1798,11 @@ static int restore_root_task(struct pstree_item *init)
 	if (ret < 0)
 		goto out_kill;
 
+	ret = prepare_cgroup_properties();
+	fini_cgroup();
+	if (ret < 0)
+		goto out_kill;
+
 	ret = run_scripts(ACT_POST_RESTORE);
 	if (ret != 0) {
 		pr_err("Aborting restore due to script ret code %d\n", ret);
@@ -1934,13 +1939,8 @@ int cr_restore_tasks(void)
 	if (criu_signals_setup() < 0)
 		goto err;
 
-	if (restore_root_task(root_item) < 0)
-		goto err;
-
-	ret = prepare_cgroup_properties();
-
+	ret = restore_root_task(root_item);
 err:
-	fini_cgroup();
 	cr_plugin_fini(CR_PLUGIN_STAGE__RESTORE, ret);
 	return ret;
 }
-- 
2.1.0



More information about the CRIU mailing list