Commit 3c18439e authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

dump: save master_id for the root mount

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-43260Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent c37324b6
...@@ -3373,6 +3373,7 @@ int mntns_get_root_by_mnt_id(int mnt_id) ...@@ -3373,6 +3373,7 @@ int mntns_get_root_by_mnt_id(int mnt_id)
struct collect_mntns_arg { struct collect_mntns_arg {
bool need_to_validate; bool need_to_validate;
bool for_dump; bool for_dump;
int root_master_id;
}; };
static int collect_mntns(struct ns_id *ns, void *__arg) static int collect_mntns(struct ns_id *ns, void *__arg)
...@@ -3388,6 +3389,10 @@ static int collect_mntns(struct ns_id *ns, void *__arg) ...@@ -3388,6 +3389,10 @@ static int collect_mntns(struct ns_id *ns, void *__arg)
arg->need_to_validate = true; arg->need_to_validate = true;
mntinfo_add_list(pms); 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; return 0;
} }
...@@ -3410,7 +3415,7 @@ int collect_mnt_namespaces(bool for_dump) ...@@ -3410,7 +3415,7 @@ int collect_mnt_namespaces(bool for_dump)
if (arg.need_to_validate) { if (arg.need_to_validate) {
ret = -1; ret = -1;
if (resolve_shared_mounts(mntinfo, 0)) if (resolve_shared_mounts(mntinfo, arg.root_master_id))
goto err; goto err;
if (validate_mounts(mntinfo, true)) if (validate_mounts(mntinfo, true))
goto err; goto err;
......
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