[CRIU] [PATCH v2 4/5] cgroup: allow dumping non-criu cgsets that don't match the root
Tycho Andersen
tycho.andersen at canonical.com
Sun Feb 21 11:28:52 PST 2016
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
criu/cgroup.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/criu/cgroup.c b/criu/cgroup.c
index cf474f9..fbe91d3 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -519,6 +519,10 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag)
mtype = find_dir(ncd->path, ¤t_controller->heads, &match);
switch (mtype) {
+ /* ignore co-mounted cgroups and already dumped cgroups */
+ case EXACT_MATCH:
+ exit_code = 0;
+ goto out;
case PARENT_MATCH:
list_add_tail(&ncd->siblings, &match->children);
match->n_children++;
@@ -527,8 +531,6 @@ static int add_cgroup(const char *fpath, const struct stat *sb, int typeflag)
list_add_tail(&ncd->siblings, ¤t_controller->heads);
current_controller->n_heads++;
break;
- /* the same hierarchy won't be walked twice for a single process */
- case EXACT_MATCH:
default:
BUG();
}
@@ -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))
return -1;
+ } else {
+ pr_info("Set %d is a stray\n", cs->id);
+ if (collect_cgroups(&cs->ctls))
+ return -1;
}
*cg_id = cs->id;
@@ -915,18 +921,10 @@ int dump_cgroups(void)
/*
* Check whether root task lives in its own set as compared
- * to criu. If yes, we should not dump anything, but make
- * sure no other sets exist. The latter case can be supported,
- * but requires some trickery and is hardly needed at the
- * moment.
+ * to criu. If yes, we should not dump anything.
*/
- if (root_cgset == criu_cgset) {
- if (!list_is_singular(&cg_sets)) {
- pr_err("Non supported sub-cgroups found\n");
- return -1;
- }
-
+ if (root_cgset == criu_cgset && list_is_singular(&cg_sets)) {
pr_info("All tasks in criu's cgroups. Nothing to dump.\n");
return 0;
}
--
2.5.0
More information about the CRIU
mailing list