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

Andrey Vagin avagin at openvz.org
Thu Jul 24 14:12:26 PDT 2014


Current on dump it is executed for each namespace, so we can skip
dependencies between namespace. 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.

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