From: Robert Vogelgesang Date: Wed, 29 Jan 2014 13:52:35 +0000 (+0100) Subject: Two further cgroup cleanups: X-Git-Tag: lxc-1.0.0.beta4~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1dad6f60dd68d6e44712ec469f34dbfd1c596ca;p=thirdparty%2Flxc.git Two further cgroup cleanups: Move the test of mp->need_cpuset_init to a logically better place. Avoid misleading error messages. Signed-off-by: Robert Vogelgesang Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index fd6015539..bf5dfe3eb 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -2107,9 +2107,6 @@ static bool do_init_cpuset_file(struct cgroup_mount_point *mp, int ret; bool ok = false; - if (!mp->need_cpuset_init) - return true; - childfile = cgroup_to_absolute_path(mp, path, name); if (!childfile) return false; @@ -2150,10 +2147,10 @@ static bool do_init_cpuset_file(struct cgroup_mount_point *mp, goto out; } ok = (lxc_write_to_file(childfile, value, strlen(value), false) >= 0); - -out: if (!ok) SYSERROR("failed writing %s", childfile); + +out: if (parentfile) free(parentfile); free(childfile); @@ -2168,6 +2165,9 @@ static bool init_cpuset_if_needed(struct cgroup_mount_point *mp, (const char **)mp->hierarchy->subsystems)) return true; + if (!mp->need_cpuset_init) + return true; + return (do_init_cpuset_file(mp, path, "/cpuset.cpus") && do_init_cpuset_file(mp, path, "/cpuset.mems") ); }