[PATCH] mount devpts with newinstance

Andrey Vagin avagin at openvz.org
Mon Mar 31 01:41:35 PDT 2014


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 include/tty.h |  2 +-
 mount.c       | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/tty.h b/include/tty.h
index d2c31e2..580061c 100644
--- a/include/tty.h
+++ b/include/tty.h
@@ -6,7 +6,7 @@
 /* Kernel's limit */
 #define TERMIOS_NCC	19
 
-#define PTMX_PATH	"/dev/ptmx"
+#define PTMX_PATH	"/dev/pts/ptmx"
 #ifndef PTMX_MINOR
 # define PTMX_MINOR 2
 #endif
diff --git a/mount.c b/mount.c
index 10d1378..1b16e6c 100644
--- a/mount.c
+++ b/mount.c
@@ -771,9 +771,25 @@ static int dump_one_mountpoint(struct mount_info *pm, int fd)
 		me.with_plugin = true;
 	}
 
+	if (me.fstype == FSTYPE__DEVPTS) {
+		char *buf;
+		int len;
+
+		len = snprintf(NULL, 0, "%s,newinstance", pm->options);
+		buf = xmalloc(len + 1);
+		if (buf < 0)
+			return -1;
+		snprintf(buf, len + 1, "%s,newinstance", pm->options);
+
+		me.options = buf;
+	}
+
 	if (pb_write_one(fd, &me, PB_MNT))
 		return -1;
 
+	if (me.fstype == FSTYPE__DEVPTS)
+		xfree(me.options);
+
 	return 0;
 }
 
@@ -1067,7 +1083,7 @@ static int do_new_mount(struct mount_info *mi)
 
 	if (mount(src, mi->mountpoint, tp->name,
 			mi->flags & (~MS_SHARED), mi->options) < 0) {
-		pr_perror("Can't mount at %s", mi->mountpoint);
+		pr_perror("Can't mount at %s %s", mi->mountpoint, mi->options);
 		return -1;
 	}
 
-- 
1.8.5.3


--gKMricLos+KVdGMg--


More information about the CRIU mailing list