]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: cgfsng_create()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 17 Feb 2018 18:27:52 +0000 (19:27 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 21 Feb 2018 14:48:38 +0000 (15:48 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index ca025268fb73c1c3f66a574f272e614b0320a5ff..081a063113ac2276277c4eb2c4322ce7241fe564 100644 (file)
@@ -1746,9 +1746,8 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
        h->fullcgpath = NULL;
 }
 
-/*
- * Try to create the same cgroup in all hierarchies.
- * Start with cgroup_pattern; next cgroup_pattern-1, -2, ..., -999
+/* Try to create the same cgroup in all hierarchies. Start with cgroup_pattern;
+ * next cgroup_pattern-1, -2, ..., -999.
  */
 static inline bool cgfsng_create(void *hdata)
 {
@@ -1782,6 +1781,7 @@ again:
                ERROR("Too many conflicting cgroup names");
                goto out_free;
        }
+
        if (idx) {
                int ret;
 
@@ -1796,10 +1796,11 @@ again:
                        }
                }
        }
+
        for (i = 0; hierarchies[i]; i++) {
                if (!create_path_for_hierarchy(hierarchies[i], container_cgroup)) {
                        int j;
-                       ERROR("Failed to create \"%s\"", hierarchies[i]->fullcgpath);
+                       ERROR("Failed to create cgroup \"%s\"", hierarchies[i]->fullcgpath);
                        free(hierarchies[i]->fullcgpath);
                        hierarchies[i]->fullcgpath = NULL;
                        for (j = 0; j < i; j++)
@@ -1808,12 +1809,14 @@ again:
                        goto again;
                }
        }
-       /* Done */
+
        d->container_cgroup = container_cgroup;
+
        return true;
 
 out_free:
        free(container_cgroup);
+
        return false;
 }