Skip to content

Commit

Permalink
cgfsng: make sure a cgroup does not already exist
Browse files Browse the repository at this point in the history
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: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
hallyn committed Mar 9, 2016
1 parent b4ffcca commit d8da679
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lxc/cgfsng.c
Expand Up @@ -1031,6 +1031,8 @@ struct cgroup_ops *cgfsng_ops_init(void)
static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
{
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))
return false;
return mkdir_p(h->fullcgpath, 0755) == 0;
Expand Down

0 comments on commit d8da679

Please sign in to comment.