From: Serge Hallyn Date: Wed, 13 Jan 2016 18:05:18 +0000 (-0800) Subject: cgmanager: drop the cgm_supports_multiple_controllers bool X-Git-Tag: lxc-2.0.0.beta2~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e376eee6a71b3357c4614c42577c4d9fc87a33a;p=thirdparty%2Flxc.git cgmanager: drop the cgm_supports_multiple_controllers bool 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 --- diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c index c973bacda..06a3b195b 100644 --- a/src/lxc/cgmanager.c +++ b/src/lxc/cgmanager.c @@ -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()) {