[CRIU] [PATCH] mount: resolve parent mount of symbolic link correctly
Pavel Emelyanov
xemul at virtuozzo.com
Tue Jul 26 06:15:35 PDT 2016
On 07/26/2016 01:42 AM, Andrew Vagin wrote:
> On Mon, Jul 25, 2016 at 02:26:01PM +0000, Katerina Koukiou wrote:
>> 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: Katerina Koukiou <k.koukiou at gmail.com>
>> ---
>> criu/mount.c | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/criu/mount.c b/criu/mount.c
>> index 7c280c0..0cd83af 100644
>> --- a/criu/mount.c
>> +++ b/criu/mount.c
>> @@ -3420,6 +3420,8 @@ int prepare_mnt_ns(void)
>> return -1;
>> } else {
>> struct mount_info *mi;
>> + char *ret;
>> + char path[PATH_MAX + 1];
>
> PATH_MAX is enough, it includes '\0'
>>
>> /*
>> * The whole tree of mountpoints is to be moved into one
>> @@ -3428,8 +3430,14 @@ int prepare_mnt_ns(void)
>> * with a single umount call later.
>> */
>>
>> + ret = realpath(opts.root, path);
>
> realpath returns a string, but a type of ret is int.
No, there's new char *ret in this block :)
>> + 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. */
>> - mi = mount_resolve_path(ns.mnt.mntinfo_tree, opts.root);
>> + mi = mount_resolve_path(ns.mnt.mntinfo_tree, path);
>> if (mi == NULL) {
>> pr_err("Unable to find mount point for %s\n", opts.root);
>> return -1;
>> --
>> 2.7.3
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
>
More information about the CRIU
mailing list