[CRIU] [PATCH 02/11] mount: execute collect shared for all mounts

Andrey Vagin avagin at openvz.org
Sun Aug 3 11:31:16 PDT 2014


Currently collect_shared is executed for each mount namespace separately,
so we can skip dependencies between namespaces.

For example we can have two namespaces.
The first one contains a tmpfs mount and the second one contains a
non-root bind-mount of this tmpfs. Without this patch this example can't
be dumped.

On restoer mnt_build_tree() is called for all namespaces, so we have not
got bugs yet.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mount.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mount.c b/mount.c
index 32410eb..50171a3 100644
--- a/mount.c
+++ b/mount.c
@@ -545,8 +545,6 @@ static struct mount_info *mnt_build_tree(struct mount_info *list)
 		return NULL;
 
 	mnt_resort_siblings(tree);
-	if (collect_shared(list))
-		return NULL;
 	pr_info("Done:\n");
 	mnt_tree_show(tree, 0);
 	return tree;
@@ -1859,6 +1857,9 @@ static int populate_mnt_ns(struct mount_info *mis)
 	if (!pms)
 		return -1;
 
+	if (collect_shared(mis))
+		return -1;
+
 	for (nsid = ns_ids; nsid; nsid = nsid->next) {
 		if (nsid->nd != &mnt_ns_desc)
 			continue;
@@ -2107,6 +2108,8 @@ static int walk_mnt_ns(int (*cb)(struct ns_id *, struct mount_info *, void *), v
 
 		mntinfo_add_list(pms);
 	}
+	if (collect_shared(mntinfo))
+		goto err;
 	ret = 0;
 err:
 	return ret;
-- 
1.8.5.3



More information about the CRIU mailing list