[CRIU] [PATCH] mount: Create target of bind mount if it doesn't exist
Saied Kazemi
saied at google.com
Thu Aug 28 09:18:32 PDT 2014
The error that I get is:
(00.048051) 1: Error (files-reg.c:862): Can't open file dev/null on
restore: No such file or directory
In my case, I think that files in /dev are manually created by Docker
*after* the filesystem is set up. IOW, they are not part of the AUFS or
UnionFS branches. When we dump the process, causing it to exit, the
filesystem is dismantled. Right now, I am re-creating the filesystem
before restore so I have to do the same thing that Docker does (i.e.,
creating /dev/null). Once there is native support in Docker for dump and
restore, Docker itself would set up the filesystem before calling criu to
restore, and this problem will go away.
Haven't had time to dig deeper. But does the above explanation make sense
to you?
--Saied
On Thu, Aug 28, 2014 at 9:07 AM, Pavel Emelyanov <xemul at parallels.com>
wrote:
> On 08/28/2014 07:43 PM, Saied Kazemi wrote:
> > I have seen a similar case where /dev/null is missing (Docker using
> UnionFS). While this patch fixes
> > the issue, I am wondering why the target file should be missing to start
> with and whether *always*
> > recreating missing target files could be masking more serious issues.
> Any thoughts?
>
> +1 I'd also like to know the reasons why the mountpoint target doesn't
> exist.
> AFAIK rmdir/unlink doesn't work on dirs/files that are mountpoints.
>
> > --Saied
> >
> >
> >
> > On Thu, Aug 28, 2014 at 8:27 AM, Tycho Andersen <
> tycho.andersen at canonical.com <mailto:tycho.andersen at canonical.com>> wrote:
> >
> > If the target of a bind mount doesn't exist, create it. In
> particular, this
> > happens with /dev/ptmx across hosts under LXC. We could also mkdir
> -p any path
> > to the target, although I'm not sure if that is a case that occurrs
> in the
> > wild.
> >
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com <mailto:
> tycho.andersen at canonical.com>>
> > ---
> > mount.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/mount.c b/mount.c
> > index 9bb8a17..2108907 100644
> > --- a/mount.c
> > +++ b/mount.c
> > @@ -1346,6 +1346,24 @@ static int do_bind_mount(struct mount_info
> *mi)
> > root = rpath;
> > do_bind:
> > pr_info("\tBind %s to %s\n", root, mi->mountpoint);
> > +
> > + if (access(mi->mountpoint, F_OK)) {
> > + if (errno == ENOENT) {
> > + FILE *f;
> > +
> > + f = fopen(mi->mountpoint, "w");
> > + if (!f) {
> > + pr_perror("couldn't write 0
> length %s", mi->mountpoint);
> > + return -1;
> > + }
> > +
> > + fclose(f);
> > + } else {
> > + pr_perror("Couldn't access %s",
> mi->mountpoint);
> > + return -1;
> > + }
> > + }
> > +
> > if (mount(root, mi->mountpoint, NULL,
> > MS_BIND, NULL) < 0) {
> > pr_perror("Can't mount at %s",
> mi->mountpoint);
> > --
> > 1.9.1
> >
> > _______________________________________________
> > CRIU mailing list
> > CRIU at openvz.org <mailto: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/20140828/451d229c/attachment.html>
More information about the CRIU
mailing list