Commit 736a2940 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

cgroup: allow dumping non-criu cgsets that don't match the root

Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 1b291d8b
...@@ -519,6 +519,10 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag) ...@@ -519,6 +519,10 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag)
mtype = find_dir(ncd->path, &current_controller->heads, &match); mtype = find_dir(ncd->path, &current_controller->heads, &match);
switch (mtype) { switch (mtype) {
/* ignore co-mounted cgroups and already dumped cgroups */
case EXACT_MATCH:
exit_code = 0;
goto out;
case PARENT_MATCH: case PARENT_MATCH:
list_add_tail(&ncd->siblings, &match->children); list_add_tail(&ncd->siblings, &match->children);
match->n_children++; match->n_children++;
...@@ -527,8 +531,6 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag) ...@@ -527,8 +531,6 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag)
list_add_tail(&ncd->siblings, &current_controller->heads); list_add_tail(&ncd->siblings, &current_controller->heads);
current_controller->n_heads++; current_controller->n_heads++;
break; break;
/* the same hierarchy won't be walked twice for a single process */
case EXACT_MATCH:
default: default:
BUG(); BUG();
} }
...@@ -698,6 +700,10 @@ int dump_task_cgroup(struct pstree_item *item, u32 *cg_id, struct parasite_dump_ ...@@ -698,6 +700,10 @@ int dump_task_cgroup(struct pstree_item *item, u32 *cg_id, struct parasite_dump_
*/ */
if (cs != criu_cgset && collect_cgroups(&cs->ctls)) if (cs != criu_cgset && collect_cgroups(&cs->ctls))
return -1; return -1;
} else {
pr_info("Set %d is a stray\n", cs->id);
if (collect_cgroups(&cs->ctls))
return -1;
} }
*cg_id = cs->id; *cg_id = cs->id;
...@@ -915,18 +921,10 @@ int dump_cgroups(void) ...@@ -915,18 +921,10 @@ int dump_cgroups(void)
/* /*
* Check whether root task lives in its own set as compared * Check whether root task lives in its own set as compared
* to criu. If yes, we should not dump anything, but make * to criu. If yes, we should not dump anything.
* sure no other sets exist. The latter case can be supported,
* but requires some trickery and is hardly needed at the
* moment.
*/ */
if (root_cgset == criu_cgset) { if (root_cgset == criu_cgset && list_is_singular(&cg_sets)) {
if (!list_is_singular(&cg_sets)) {
pr_err("Non supported sub-cgroups found\n");
return -1;
}
pr_info("All tasks in criu's cgroups. Nothing to dump.\n"); pr_info("All tasks in criu's cgroups. Nothing to dump.\n");
return 0; return 0;
} }
......
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