[Devel] [patch 2/2] [PATCH rh7] ve/devpts: Assign containers @devpts_sb on first mount

Cyrill Gorcunov gorcunov at gmail.com
Thu Jul 23 01:27:11 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 somehow incomplete.

Lets assign container's superblock @devpts_sb at its first mount
call so if devpts was mounted without @newinstance the caller still
get proper superblock.

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

Former-patch-by: Vladimir Davydov <vdavydov at virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Andrey Vagin <avagin at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
CC: Pavel Emelyanov <xemul at virtuozzo.com>
---
 fs/devpts/inode.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-pcs7.git/fs/devpts/inode.c
===================================================================
--- linux-pcs7.git.orig/fs/devpts/inode.c
+++ linux-pcs7.git/fs/devpts/inode.c
@@ -410,7 +410,7 @@ static int test_devpts_sb(struct super_b
 static int set_devpts_sb(struct super_block *s, void *p)
 {
 	int error = set_anon_super(s, p);
-	if (!error) {
+	if (!error && !get_exec_env()->devpts_sb) {
 		atomic_inc(&s->s_active);
 		get_exec_env()->devpts_sb = s;
 	}
@@ -463,7 +463,7 @@ static struct dentry *devpts_mount(struc
 		return ERR_PTR(-EINVAL);
 
 	if (opts.newinstance)
-		s = sget(fs_type, NULL, set_anon_super, flags, NULL);
+		s = sget(fs_type, NULL, set_devpts_sb, flags, NULL);
 	else
 		s = sget(fs_type, test_devpts_sb, set_devpts_sb, flags, NULL);
 




More information about the Devel mailing list