Commit 488fc072 authored by Katerina Koukiou's avatar Katerina Koukiou Committed by Pavel Emelyanov

mount: resolve parent mount of symbolic link correctly

When using --root option in criu dump, when the mountpoint passed
contains a symbolic link, criu does not resolve its parent correctly.
e.g when passing --root /run/rootfs, dump finishes successfully;
but when /var/run/rootfs is passed, where /var/run is symbolic link to
/run it exits with error "New root and old root are the same".
Signed-off-by: 's avatarKaterina Koukiou <k.koukiou@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 227ffd3e
...@@ -3382,6 +3382,8 @@ int prepare_mnt_ns(void) ...@@ -3382,6 +3382,8 @@ int prepare_mnt_ns(void)
return -1; return -1;
} else { } else {
struct mount_info *mi; struct mount_info *mi;
char *ret;
char path[PATH_MAX];
/* /*
* The whole tree of mountpoints is to be moved into one * The whole tree of mountpoints is to be moved into one
...@@ -3390,8 +3392,14 @@ int prepare_mnt_ns(void) ...@@ -3390,8 +3392,14 @@ int prepare_mnt_ns(void)
* with a single umount call later. * with a single umount call later.
*/ */
ret = realpath(opts.root, path);
if (!ret) {
pr_err("Unable to find real path for %s\n", opts.root);
return -1;
}
/* moving a mount residing under a shared mount is invalid. */ /* moving a mount residing under a shared mount is invalid. */
mi = mount_resolve_path(ns.mnt.mntinfo_tree, opts.root); mi = mount_resolve_path(ns.mnt.mntinfo_tree, path);
if (mi == NULL) { if (mi == NULL) {
pr_err("Unable to find mount point for %s\n", opts.root); pr_err("Unable to find mount point for %s\n", opts.root);
return -1; return -1;
......
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