Skip to content

Commit

Permalink
cgfsng: do MS_REMOUNT
Browse files Browse the repository at this point in the history
Perform MS_REMOUNT on mounts with MS_RDONLY.

Signed-off-by: LiFeng <lifeng68@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
lifeng68 authored and Christian Brauner committed Feb 7, 2018
1 parent 3fb8253 commit f8c40ff
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -1947,6 +1947,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;
Expand Down

0 comments on commit f8c40ff

Please sign in to comment.