Commit f16d7c64 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: remove root with MS_PRIVATE before cleaning up mntns

Otherwise we will clean up the root mntns too.
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 929a0f24
...@@ -574,6 +574,11 @@ static int clean_mnt_ns(void) ...@@ -574,6 +574,11 @@ static int clean_mnt_ns(void)
* Mountinfos were collected at prepare stage * Mountinfos were collected at prepare stage
*/ */
if (mount("none", "/", "none", MS_REC|MS_PRIVATE, NULL)) {
pr_perror("Can't remount root with MS_PRIVATE");
return -1;
}
pm = mnt_build_tree(mntinfo); pm = mnt_build_tree(mntinfo);
if (!pm) if (!pm)
return -1; return -1;
......
...@@ -19,6 +19,10 @@ static int test_fn(int argc, char **argv) ...@@ -19,6 +19,10 @@ static int test_fn(int argc, char **argv)
int fd, tmpfs_fd; int fd, tmpfs_fd;
unsigned fs_cnt, fs_cnt_last = 0; unsigned fs_cnt, fs_cnt_last = 0;
if (mount("none", "/", "none", MS_REC|MS_PRIVATE, NULL)) {
err("Can't remount root with MS_PRIVATE");
return -1;
}
again: again:
fs_cnt = 0; fs_cnt = 0;
f = fopen("/proc/self/mountinfo", "r"); f = fopen("/proc/self/mountinfo", "r");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment