]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgmanager: drop the cgm_supports_multiple_controllers bool
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 13 Jan 2016 18:05:18 +0000 (10:05 -0800)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 13 Jan 2016 18:05:18 +0000 (10:05 -0800)
What we want is to make sure we dont' use controller 'all' if cgmanager
doesn't support, if all our cgroups aren't the same, or if we cannot
controll all our cgroups.  We were mixing some of these conditions.  Use
cgm_all_controllers_same for all.  (Might want to rename it, but we want
to stick with just one).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/cgmanager.c

index c973bacda3ee96b09e5cb77f63b8601381a1a729..06a3b195b4c2cc27cc5f0cad46ad80a0623b5f85 100644 (file)
@@ -183,11 +183,6 @@ static bool cgm_dbus_connect(void)
        return true;
 }
 
-static bool cgm_supports_multiple_controllers;
-/*
- * if cgm_all_controllers_same is true, then cgm_supports_multiple_controllers
- * is true
- */
 static bool cgm_all_controllers_same;
 
 /*
@@ -207,11 +202,8 @@ static void check_supports_multiple_controllers(pid_t pid)
        size_t sz = 0;
        char path[100];
 
-       cgm_supports_multiple_controllers = false;
        cgm_all_controllers_same = false;
 
-       cgm_supports_multiple_controllers = true;
-
        if (pid == -1)
                sprintf(path, "/proc/self/cgroup");
        else
@@ -445,7 +437,7 @@ static int chown_cgroup_wrapper(void *data)
        }
        destuid = get_ns_uid(arg->origuid);
 
-       if (cgm_supports_multiple_controllers)
+       if (cgm_all_controllers_same)
                slist = subsystems_inone;
 
        for (i = 0; slist[i]; i++) {
@@ -503,7 +495,7 @@ static bool chown_cgroup(const char *cgroup_path, struct lxc_conf *conf)
         * This can't be done in the child namespace because it only group-owns
         * the cgroup
         */
-       if (cgm_supports_multiple_controllers)
+       if (cgm_all_controllers_same)
                slist = subsystems_inone;
 
        for (i = 0; slist[i]; i++) {
@@ -579,7 +571,7 @@ static void cgm_destroy(void *hdata)
                return;
        }
 
-       if (cgm_supports_multiple_controllers)
+       if (cgm_all_controllers_same)
                slist = subsystems_inone;
        for (i = 0; slist[i]; i++)
                cgm_remove_cgroup(slist[i], d->cgroup_path);
@@ -599,7 +591,7 @@ static inline void cleanup_cgroups(char *path)
        int i;
        char **slist = subsystems;
 
-       if (cgm_supports_multiple_controllers)
+       if (cgm_all_controllers_same)
                slist = subsystems_inone;
        for (i = 0; slist[i]; i++)
                cgm_remove_cgroup(slist[i], path);
@@ -645,7 +637,7 @@ again:
        }
        existed = 0;
 
-       if (cgm_supports_multiple_controllers)
+       if (cgm_all_controllers_same)
                slist = subsystems_inone;
 
        for (i = 0; slist[i]; i++) {
@@ -1456,7 +1448,7 @@ struct cgroup_ops *cgm_ops_init(void)
                return NULL;
 
        if (api_version < CGM_SUPPORTS_MULT_CONTROLLERS)
-               cgm_supports_multiple_controllers = false;
+               cgm_all_controllers_same = false;
 
        // if root, try to escape to root cgroup
        if (geteuid() == 0 && !cgm_escape()) {