[CRIU] [PATCH] dump: save master_id for the root mount
Andrey Vagin
avagin at openvz.org
Tue Jan 26 15:01:05 PST 2016
From: Andrew Vagin <avagin at virtuozzo.com>
The root mount is always external and master_id is external too.
It's required to validate mounts. We already do this on restore,
but we need to do this on dump too. Otherwise we will get the error:
Mount %d %s (master_id: %d shared_id: %d) has unreachable sharing. Try --enable-external-masters.
https://jira.sw.ru/browse/PSBM-43260
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
mount.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mount.c b/mount.c
index 2e11223..2dbd0c0 100644
--- a/mount.c
+++ b/mount.c
@@ -3371,6 +3371,7 @@ int mntns_get_root_by_mnt_id(int mnt_id)
struct collect_mntns_arg {
bool need_to_validate;
bool for_dump;
+ int root_master_id;
};
static int collect_mntns(struct ns_id *ns, void *__arg)
@@ -3386,6 +3387,10 @@ static int collect_mntns(struct ns_id *ns, void *__arg)
arg->need_to_validate = true;
mntinfo_add_list(pms);
+
+ if (arg->need_to_validate && ns->id == root_item->ids->mnt_ns_id)
+ arg->root_master_id = ns->mnt.mntinfo_tree->master_id;
+
return 0;
}
@@ -3408,7 +3413,7 @@ int collect_mnt_namespaces(bool for_dump)
if (arg.need_to_validate) {
ret = -1;
- if (resolve_shared_mounts(mntinfo, 0))
+ if (resolve_shared_mounts(mntinfo, arg.root_master_id))
goto err;
if (validate_mounts(mntinfo, true))
goto err;
--
2.4.3
More information about the CRIU
mailing list