Commit e7e63a0d authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

mount: don't rewrite root for external mounts

It's used to restore bind-mounts. For example, we cat the common
part of bind-mounts:

Core was generated by `criu restore -vvvv --file-locks --tcp-established --evasive-devices --manage-cg'.
Program terminated with signal 11, Segmentation fault.
741                     BUG_ON(target_root[tok] == '\0');
(gdb) bt

https://jira.sw.ru/browse/PSBM-41932

Reported-by: Virtuozzo QA Team
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ea747b07
...@@ -2295,7 +2295,7 @@ static int do_bind_mount(struct mount_info *mi) ...@@ -2295,7 +2295,7 @@ static int do_bind_mount(struct mount_info *mi)
* is tuned in collect_mnt_from_image to refer * is tuned in collect_mnt_from_image to refer
* to proper location in the namespace we restore. * to proper location in the namespace we restore.
*/ */
root = mi->root; root = mi->external->val;
force_private_remount = mi->internal_sharing; force_private_remount = mi->internal_sharing;
goto do_bind; goto do_bind;
} }
...@@ -2677,13 +2677,12 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) ...@@ -2677,13 +2677,12 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi)
{ {
struct ext_mount *em = NULL; struct ext_mount *em = NULL;
if (!me->ext_mount) { mi->root = xstrdup(me->root);
mi->root = xstrdup(me->root); if (!mi->root)
if (!mi->root) return -1;
return -1;
if (!me->ext_mount)
goto out; goto out;
}
/* /*
* External mount point -- get the reverse mapping * External mount point -- get the reverse mapping
...@@ -2716,10 +2715,9 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi) ...@@ -2716,10 +2715,9 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi)
} }
mi->external = em; mi->external = em;
mi->root = em->val;
out: out:
pr_debug("\t\tWill mount %d from %s%s\n", pr_debug("\t\tWill mount %d from %s%s\n",
mi->mnt_id, mi->root, em ? " (E)" : ""); mi->mnt_id, em ? em->val : mi->root, em ? " (E)" : "");
return 0; return 0;
} }
......
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