From 1edfe53b71b66fe24d8942ece606464d1269a181 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Mon, 21 Apr 2014 18:23:16 +0400 Subject: [PATCH] mounts: Connect sub-root to the main root as children Each sub-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 Signed-off-by: Pavel Emelyanov --- mount.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mount.c b/mount.c index 24032d372..abfbcaf66 100644 --- a/mount.c +++ b/mount.c @@ -232,7 +232,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_ns_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;