]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfs: ignore mount prefix in mountinfo if cgroup namespaces are supported 856/head
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 26 Feb 2016 21:35:24 +0000 (13:35 -0800)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 26 Feb 2016 21:35:24 +0000 (13:35 -0800)
This is not 100% correct, but will suffice until we fix the kernel so that
we can distinguish between bind mounts and namespaced cgroupfs mounts.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/cgfs.c

index 8c1cb64eaef5a8baff0fdbdab0e99900d7ba630e..16c80ebe35fabc9ada6ab873b4a51716d408e325 100644 (file)
@@ -418,6 +418,7 @@ static bool find_hierarchy_mountpts( struct cgroup_meta_data *meta_data, char **
        size_t mount_point_capacity = 0;
        size_t token_capacity = 0;
        int r;
+       bool is_cgns = cgns_supported();
 
        proc_self_mountinfo = fopen_cloexec("/proc/self/mountinfo", "r");
        /* if for some reason (because of setns() and pid namespace for example),
@@ -512,7 +513,7 @@ static bool find_hierarchy_mountpts( struct cgroup_meta_data *meta_data, char **
                meta_data->mount_points[mount_point_count++] = mount_point;
 
                mount_point->hierarchy = h;
-               if (is_lxcfs)
+               if (is_lxcfs || is_cgns)
                        mount_point->mount_prefix = strdup("/");
                else
                        mount_point->mount_prefix = strdup(tokens[3]);