[CRIU] [PATCH] cgroup: Don't collect criu's stray cgset

Pavel Emelyanov xemul at virtuozzo.com
Thu Feb 25 05:02:53 PST 2016


In commit 736a2940 there was added a collection of non-root task's
cgsets. But criu's cgset should anyway be excluded from it.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>

P.S.

Tycho, would you be able to cook a test for dumping cgroups that don't
match the root? :)

---
 criu/cgroup.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index fbe91d3..272df29 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -689,10 +689,13 @@ int dump_task_cgroup(struct pstree_item *item, u32 *cg_id, struct parasite_dump_
 		BUG_ON(criu_cgset);
 		criu_cgset = cs;
 		pr_info("Set %d is criu one\n", cs->id);
-	} else if (item == root_item) {
-		BUG_ON(root_cgset);
-		root_cgset = cs;
-		pr_info("Set %d is root one\n", cs->id);
+	} else {
+		if (item == root_item) {
+			BUG_ON(root_cgset);
+			root_cgset = cs;
+			pr_info("Set %d is root one\n", cs->id);
+		} else
+			pr_info("Set %d is a stray\n", cs->id);
 
 		/*
 		 * The on-stack ctls is moved into cs inside
@@ -700,10 +703,6 @@ 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;
-- 
2.5.0


More information about the CRIU mailing list