[CRIU] Re: [PATCH 1/2] zdtm: Mount devpts in new root

Cyrill Gorcunov gorcunov at openvz.org
Sun Sep 30 16:33:40 EDT 2012


On Sun, Sep 30, 2012 at 11:15:51PM +0400, Cyrill Gorcunov wrote:
> On Sun, Sep 30, 2012 at 10:47:41PM +0400, Andrey Wagin wrote:
> > 2012/9/30 Cyrill Gorcunov <gorcunov at openvz.org>:
> > > In case if we enter the new rootfs don't forget to
> > > mount devpts, otherwise ttys can't be connected.
> > >
> > > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > > ---
> > >  test/zdtm/lib/ns.c |    4 ++++
> > >  1 files changed, 4 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
> > > index 664715f..bf10666 100644
> > > --- a/test/zdtm/lib/ns.c
> > > +++ b/test/zdtm/lib/ns.c
> > > @@ -107,6 +107,10 @@ done:
> > >                         fprintf(stderr, "mount(/proc) failed: %m\n");
> > >                         return -1;
> > >                 }
> > > +               if (mount("pts", "/dev/pts", "devpts", MS_MGC_VAL, NULL)) {
> > > +                       fprintf(stderr, "mount(/dev/pts) failed: %m\n");
> > > +                       return -1;
> > > +               }
> > 
> > I think we should to create the directory.
> 
> On the testing machine it's created on bind mounting. Could you please
> check out if this patch doesn't work for you?

Here is updated one.
-------------- next part --------------
>From 81a19c764effc443c017ec3947a13ae1fece7ddd Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Fri, 14 Sep 2012 22:37:36 +0400
Subject: [PATCH 1/2] zdtm: Mount devpts in new root

In case if we enter the new rootfs don't forget to
mount devpts, otherwise ttys can't be connected.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm/lib/ns.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index 664715f..8f0b868 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -107,6 +107,18 @@ done:
 			fprintf(stderr, "mount(/proc) failed: %m\n");
 			return -1;
 		}
+		if (mkdir("/dev", 0755) && errno != EEXIST) {
+			fprintf(stderr, "mkdir(/dev) failed: %m\n");
+			return -1;
+		}
+		if (mkdir("/dev/pts", 0755) && errno != EEXIST) {
+			fprintf(stderr, "mkdir(/dev/pts) failed: %m\n");
+			return -1;
+		}
+		if (mount("pts", "/dev/pts", "devpts", MS_MGC_VAL, NULL)) {
+			fprintf(stderr, "mount(/dev/pts) failed: %m\n");
+			return -1;
+		}
 		if (fchdir(dfd)) {
 			fprintf(stderr, "fchdir() failed: %m\n");
 			return -1;
-- 
1.7.7.6



More information about the CRIU mailing list