Commit 7248cad9 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

finalize cgroups correctly

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@google.com>
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7c2b4b13
...@@ -1798,6 +1798,11 @@ static int restore_root_task(struct pstree_item *init) ...@@ -1798,6 +1798,11 @@ static int restore_root_task(struct pstree_item *init)
if (ret < 0) if (ret < 0)
goto out_kill; goto out_kill;
ret = prepare_cgroup_properties();
fini_cgroup();
if (ret < 0)
goto out_kill;
ret = run_scripts(ACT_POST_RESTORE); ret = run_scripts(ACT_POST_RESTORE);
if (ret != 0) { if (ret != 0) {
pr_err("Aborting restore due to script ret code %d\n", ret); pr_err("Aborting restore due to script ret code %d\n", ret);
...@@ -1936,13 +1941,8 @@ int cr_restore_tasks(void) ...@@ -1936,13 +1941,8 @@ int cr_restore_tasks(void)
if (criu_signals_setup() < 0) if (criu_signals_setup() < 0)
goto err; goto err;
if (restore_root_task(root_item) < 0) ret = restore_root_task(root_item);
goto err;
ret = prepare_cgroup_properties();
err: err:
fini_cgroup();
cr_plugin_fini(CR_PLUGIN_STAGE__RESTORE, ret); cr_plugin_fini(CR_PLUGIN_STAGE__RESTORE, ret);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment