]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: do not reuse another monitor's cgroup
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Oct 2018 15:27:55 +0000 (17:27 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Oct 2018 15:28:30 +0000 (17:28 +0200)
Otherwise we will create a race.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index e248db31afe280034f56d4af197e9b29143f6784..0fc9b11d2c01acaec95358f8866f649147599fb8 100644 (file)
@@ -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");