[CRIU] [PATCH] mount: resolve parent mount of symbolic link correctly

Katerina Koukiou k.koukiou at googlemail.com
Wed Jul 27 14:11:02 PDT 2016


On Wed, Jul 27, 2016 at 1:39 AM, Andrew Vagin <avagin at virtuozzo.com> wrote:

> On Tue, Jul 26, 2016 at 04:15:35PM +0300, Pavel Emelyanov wrote:
> > 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 :)
>
> Sorry, I haven't noticed this. Thanks.
>

It's ugly indeed. I can send a v2 without using ret for the check if needed.
Btw, any idea why the test suite currently fails on
zdtm/static/helper_zombie_child
test on restore?

>
> > >> +          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
> > > .
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20160727/812b1a35/attachment.html>


More information about the CRIU mailing list