Commit d8da679e by Serge Hallyn

cgfsng: make sure a cgroup does not already exist

Our mkdir_p ignore eexist, and of course we want that for upper path components, but the final directory itself must not already exist. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent b4ffcca8
...@@ -1031,6 +1031,8 @@ struct cgroup_ops *cgfsng_ops_init(void) ...@@ -1031,6 +1031,8 @@ struct cgroup_ops *cgfsng_ops_init(void)
static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname) static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
{ {
h->fullcgpath = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL); h->fullcgpath = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL);
if (dir_exists(h->fullcgpath)) // it must not already exist
return false;
if (!handle_cpuset_hierarchy(h, cgname)) if (!handle_cpuset_hierarchy(h, cgname))
return false; return false;
return mkdir_p(h->fullcgpath, 0755) == 0; return mkdir_p(h->fullcgpath, 0755) == 0;
......
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