]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: fix get_hierarchy() for unified hierarchy
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 24 Feb 2018 20:36:20 +0000 (21:36 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 20:30:43 +0000 (22:30 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 10086fb448abf6af272e3bbb02ddc3af280745ea..22403d7655f422b2262156ff0b2631361607d4be 100644 (file)
@@ -318,7 +318,7 @@ struct hierarchy *get_hierarchy(const char *c)
                            !hierarchies[i]->controllers[0])
                                return hierarchies[i];
 
-                       return NULL;
+                       continue;
                }
 
                if (string_in_list(hierarchies[i]->controllers, c))
@@ -1295,8 +1295,11 @@ static bool cg_hybrid_init(void)
 
                        controller_list = cg_unified_get_controllers(cgv2_ctrl_path);
                        free(cgv2_ctrl_path);
-                       if (!controller_list)
+                       if (!controller_list) {
                                controller_list = cg_unified_make_empty_controller();
+                               CGFSNG_DEBUG("No controllers are enabled for "
+                                            "delegation in the unified hierarchy\n");
+                       }
                }
 
                new = add_hierarchy(controller_list, mountpoint, base_cgroup, type);
@@ -2343,13 +2346,16 @@ static bool cgfsng_unfreeze(void *hdata)
        return true;
 }
 
-static const char *cgfsng_get_cgroup(void *hdata, const char *subsystem)
+static const char *cgfsng_get_cgroup(void *hdata, const char *controller)
 {
        struct hierarchy *h;
 
-       h = get_hierarchy(subsystem);
-       if (!h)
+       h = get_hierarchy(controller);
+       if (!h) {
+               SYSERROR("Failed to find hierarchy for controller \"%s\"",
+                        controller ? controller : "(null)");
                return NULL;
+       }
 
        return h->fullcgpath ? h->fullcgpath + strlen(h->mountpoint) : NULL;
 }