cgfsng: do MS_REMOUNT

Perform MS_REMOUNT on mounts with MS_RDONLY.

Signed-off-by: LiFeng <lifeng68@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
LiFeng 2018-02-07 11:39:59 -05:00 committed by Christian Brauner
parent 3fb8253d91
commit f8c40ffa39
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -1947,6 +1947,15 @@ static int do_secondstage_mounts_if_needed(int type, struct hierarchy *h,
cgpath); cgpath);
return -1; 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); free(sourcepath);
INFO("Completed second stage cgroup automounts for %s", cgpath); INFO("Completed second stage cgroup automounts for %s", cgpath);
return 0; return 0;