Commit e61259a8 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: mark all mounts as private in one place

This should be done before restoring a mount tree. This patch is a part
of the series about moving pivot_root, which has been committed.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f0b5bedf
......@@ -1193,11 +1193,6 @@ 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;
}
return mnt_tree_for_each_reverse(mntinfo_tree, do_umount_one);
}
......@@ -1212,11 +1207,6 @@ static int cr_pivot_root(void)
return -1;
}
if (mount("none", "/", "none", MS_REC|MS_PRIVATE, NULL)) {
pr_perror("Can't remount root with MS_PRIVATE");
return -1;
}
if (pivot_root(".", put_root)) {
pr_perror("pivot_root(., %s) failed", put_root);
if (rmdir(put_root))
......@@ -1397,6 +1387,11 @@ int prepare_mnt_ns(int ns_pid)
if (!mis)
goto out;
if (mount("none", "/", "none", MS_REC|MS_PRIVATE, NULL)) {
pr_perror("Can't remount root with MS_PRIVATE");
return -1;
}
if (chdir(opts.root ? : "/")) {
pr_perror("chdir(%s) failed", opts.root ? : "/");
return -1;
......
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