Commit 8d446a7a authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: execute collect shared for all mounts

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

For example, we 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 restore mnt_build_tree() is called for all namespaces at once, thus
this bug doesn't exist there.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 896fae70
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment