From: LiFeng Date: Wed, 7 Feb 2018 16:39:59 +0000 (-0500) Subject: cgfsng: do MS_REMOUNT X-Git-Tag: lxc-2.0.10~351 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a566f76fc2cdfee3771822d406323fa42be896e4;p=thirdparty%2Flxc.git cgfsng: do MS_REMOUNT Perform MS_REMOUNT on mounts with MS_RDONLY. Signed-off-by: LiFeng Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 9314f727d..03a36d4d5 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -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;