Commit b1dad6f6 by Robert Vogelgesang Committed by Serge Hallyn

Two further cgroup cleanups:

Move the test of mp->need_cpuset_init to a logically better place. Avoid misleading error messages. Signed-off-by: 's avatarRobert Vogelgesang <vogel@users.sourceforge.net> Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 6ff9f8ec
......@@ -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") );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment