[Devel] [PATCH rh7] ve/devpts: Force devpts mounting to use @newinstance inside VE

Cyrill Gorcunov gorcunov at virtuozzo.com
Fri Jul 17 08:33:48 PDT 2015


Modern systemd based containers (such as fedora-21, centos-7) already
mounting initial devpts filesystem with @newinstance option but it
turned out that ubuntu-14 lts doesn't, which makes restore procedure
to fail because we're using get_exec_env as a namespace mark and the
kernel mounts new superblock for container internally. This is done
to isolate devpts between containers but criu sees it as filesystems
mounted with @newinstance option. Thus lets always mount devpts
inside containers with @newinstance instead, this should not hurt
anyhow ecxept we need precious testing of docker running inside
container.

https://jira.sw.ru/browse/PSBM-34931

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Andrey Vagin <avagin at virtuozzo.com>
CC: Vladimir Davydov <vdavydov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
CC: Pavel Emelyanov <xemul at virtuozzo.com>
---

Guys, take a look please.

 fs/devpts/inode.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Index: linux-pcs7.git/fs/devpts/inode.c
===================================================================
--- linux-pcs7.git.orig/fs/devpts/inode.c
+++ linux-pcs7.git/fs/devpts/inode.c
@@ -449,6 +449,23 @@ static struct dentry *devpts_mount(struc
 	    (current_user_ns() != &init_user_ns) && !opts.newinstance)
 		return ERR_PTR(-EINVAL);
 
+#ifdef CONFIG_VE
+	/*
+	 * Mounts inside VE (startup/restore) should be considered
+	 * as a newinstance so CRIU would be happy on restore, otherwise
+	 * because mount_ns() is called with get_exec_env() it never
+	 * matches ve0's /dev/pts superblock and CRIU assumes that
+	 * newinstance aslready been passed (as it is on vanilla
+	 * kernels). After all we don't support container inside
+	 * container but need to be verified for Docker running
+	 * inside container.
+	 *
+	 * 	-- cyrillos
+	 */
+	if (!ve_is_super(get_exec_env()))
+		opts.newinstance = 1;
+#endif
+
 	if (opts.newinstance)
 		root = mount_nodev(fs_type, flags, data, devpts_fill_super);
 	else



More information about the Devel mailing list