[Devel] [PATCH RHEL7 COMMIT] ve/devpts: Assign containers @devpts_sb on first mount

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 28 03:14:16 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.3
------>
commit eae9499434822b53708cef8bd4989a457168f3ca
Author: Cyrill Gorcunov <gorcunov at gmail.com>
Date:   Fri Aug 28 14:14:16 2015 +0400

    ve/devpts: Assign containers @devpts_sb on first mount
    
    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 [CRIU] 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(-)

diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index be0fb74..4be1923 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -410,7 +410,7 @@ static int test_devpts_sb(struct super_block *s, void *p)
 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(struct file_system_type *fs_type,
 		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