Commit a180a75c authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Uninline clean_mnt_ns

Just to get rid of clean_something name. We have too
many cleaners out there already :\
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c5c65fe1
...@@ -2207,17 +2207,6 @@ static int do_umount_one(struct mount_info *mi) ...@@ -2207,17 +2207,6 @@ static int do_umount_one(struct mount_info *mi)
return 0; return 0;
} }
static int clean_mnt_ns(struct mount_info *mntinfo_tree)
{
pr_info("Cleaning mount namespace\n");
/*
* Mountinfos were collected at prepare stage
*/
return mnt_tree_for_each_reverse(mntinfo_tree, do_umount_one);
}
static int cr_pivot_root(char *root) static int cr_pivot_root(char *root)
{ {
char put_root[] = "crtools-put-root.XXXXXX"; char put_root[] = "crtools-put-root.XXXXXX";
...@@ -2770,22 +2759,30 @@ int prepare_mnt_ns(void) ...@@ -2770,22 +2759,30 @@ int prepare_mnt_ns(void)
close_proc(); close_proc();
/*
* The new mount namespace is filled with the mountpoint
* clones from the original one. We have to umount them
* prior to recreating new ones.
*/
if (!opts.root) { if (!opts.root) {
if (chdir("/")) { if (chdir("/")) {
pr_perror("chdir(\"/\") failed"); pr_perror("chdir(\"/\") failed");
return -1; return -1;
} }
if (clean_mnt_ns(ns.mnt.mntinfo_tree)) /*
* The new mount namespace is filled with the mountpoint
* clones from the original one. We have to umount them
* prior to recreating new ones.
*/
pr_info("Cleaning mount namespace\n");
if (mnt_tree_for_each_reverse(ns.mnt.mntinfo_tree, do_umount_one))
return -1; return -1;
} else { } else {
struct mount_info *mi; struct mount_info *mi;
/*
* The whole tree of mountpoints is to be moved into one
* place with the pivot_root() call. Don't do manual
* umount (as we do above), all this stuff will go away
* with a single umount call later.
*/
/* moving a mount residing under a shared mount is invalid. */ /* moving a mount residing under a shared mount is invalid. */
mi = mount_resolve_path(ns.mnt.mntinfo_tree, opts.root); mi = mount_resolve_path(ns.mnt.mntinfo_tree, opts.root);
if (mi == NULL) { if (mi == NULL) {
......
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