[CRIU] [PATCH 3/5] mnt: Uninline clean_mnt_ns
Pavel Emelyanov
xemul at parallels.com
Mon Sep 21 04:09:11 PDT 2015
Just to get rid of clean_something name. We have too
many cleaners out there already :\
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
mount.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/mount.c b/mount.c
index 55e2d92..25ce0b6 100644
--- a/mount.c
+++ b/mount.c
@@ -2213,17 +2213,6 @@ static int do_umount_one(struct mount_info *mi)
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)
{
char put_root[] = "crtools-put-root.XXXXXX";
@@ -2780,22 +2769,30 @@ int prepare_mnt_ns(void)
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 (chdir("/")) {
pr_perror("chdir(\"/\") failed");
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;
} else {
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. */
mi = mount_resolve_path(ns.mnt.mntinfo_tree, opts.root);
if (mi == NULL) {
--
1.9.3
More information about the CRIU
mailing list