mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +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:
committed by
Pavel Emelyanov
parent
929a0f24fd
commit
f16d7c64e5
5
mount.c
5
mount.c
@@ -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)
|
|||||||
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");
|
||||||
|
Reference in New Issue
Block a user