2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

mount: remove root with MS_PRIVATE before cleaning up mntns

Otherwise we will clean up the root mntns too.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrew Vagin
2013-03-26 14:16:51 +04:00
committed by Pavel Emelyanov
parent 929a0f24fd
commit f16d7c64e5
2 changed files with 9 additions and 0 deletions

View File

@@ -574,6 +574,11 @@ static int clean_mnt_ns(void)
* 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);
if (!pm)
return -1;

View File

@@ -19,6 +19,10 @@ static int test_fn(int argc, char **argv)
int fd, tmpfs_fd;
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:
fs_cnt = 0;
f = fopen("/proc/self/mountinfo", "r");