[CRIU] [PATCH 07/13] mounts: connect sub-root to the main root

Andrey Vagin avagin at openvz.org
Tue Mar 11 08:18:23 PDT 2014


A sub-mount namespace is restored as sub-tree of the root mntns, so
the parent of sub-mntns root is the root of the root mntns.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mount.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index 922ca31..22df8e9 100644
--- a/mount.c
+++ b/mount.c
@@ -238,7 +238,16 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list)
 			pr_err("Mountpoint %d w/o parent %d found @%s (root %s)\n",
 					m->mnt_id, m->parent_mnt_id, m->mountpoint,
 					root ? "found" : "not found");
-			return NULL;
+			if (root && m->is_root) {
+				/*
+				 * A root of a sub mount namespace is
+				 * mounted in a temporary directory in the
+				 * root mount namespace, so its parent is
+				 * the main root.
+				 */
+				p = root;
+			} else
+				return NULL;
 		}
 
 		m->parent = p;
-- 
1.8.5.3



More information about the CRIU mailing list