Skip to content

Commit

Permalink
cgfsng: do not reuse another monitor's cgroup
Browse files Browse the repository at this point in the history
Otherwise we will create a race.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Oct 2, 2018
1 parent 907e133 commit ee455be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -1262,8 +1262,10 @@ static bool monitor_create_path_for_hierarchy(struct hierarchy *h, char *cgname)
int ret;

h->monitor_full_path = must_make_path(h->mountpoint, h->container_base_path, cgname, NULL);
if (dir_exists(h->monitor_full_path))
return true;
if (dir_exists(h->monitor_full_path)) {
ERROR("The cgroup \"%s\" already existed", h->monitor_full_path);
return false;
}

if (!cg_legacy_handle_cpuset_hierarchy(h, cgname)) {
ERROR("Failed to handle legacy cpuset controller");
Expand Down

0 comments on commit ee455be

Please sign in to comment.