]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: do MS_REMOUNT
authorLiFeng <lifeng68@huawei.com>
Wed, 7 Feb 2018 16:39:59 +0000 (11:39 -0500)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 7 Feb 2018 11:06:48 +0000 (12:06 +0100)
Perform MS_REMOUNT on mounts with MS_RDONLY.

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

index 9314f727df1a3d6a1134aa5092f33ff3e53f16f7..03a36d4d5931278d152f3655e973aa4408b2100f 100644 (file)
@@ -1926,6 +1926,15 @@ static int do_secondstage_mounts_if_needed(int type, struct hierarchy *h,
                                cgpath);
                return -1;
        }
+
+       if (flags & MS_RDONLY) {
+               if (mount(sourcepath, cgpath, "cgroup", MS_REMOUNT | flags | MS_RDONLY, NULL) < 0) {
+                       free(sourcepath);
+                       SYSERROR("Error remounting %s read-only", cgpath);
+                       return -1;
+               }
+       }
+
        free(sourcepath);
        INFO("Completed second stage cgroup automounts for %s", cgpath);
        return 0;