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 0cdfb581770d883cea99f30e49e3de1583ab6fc1
Author: Vladimir Davydov <vdavy...@parallels.com>
Date:   Fri Aug 28 16:10:56 2015 +0400

    Revert "ve/devtmpfs: Create required devices on container startup"
    
    Patchset description:
    
    Rework devtmpfs virtualization
    
    Currently, we implement full-featured devtmpfs virtualization for VE:
    when a device is created in a VE "namespace", we send a signal to
    kdevtmpfs to create the devnode on devtmpfs mount corresponding to the
    VE. This seems to be over-complicated: all this work can be done from
    userspace, because we only have a hardcoded list of devices created
    exclusively for VE on container start. Those are tty-related stuff and
    mem devices, and we only need the latter to create devtmpfs nodes.
    Moreover, it is buggy: ve_stop_ns, which destroys VE devtmpfs mount can
    be called before a VE tty device is unregistered, resulting in a KP:
    
    https://jira.sw.ru/browse/PSBM-35077
    
    This patch therefore simplifies it. It makes the kernel only provide a
    single empty tmpfs mount per VE, which appears on an attempt to mount
    devtmpfs from inside a VE. The content of the fs is to be filled by the
    userspace on container start, which will be done in the scope of
    
    https://jira.sw.ru/browse/PSBM-35146
    
    Vladimir Davydov (6):
      Revert "ve/devtmpfs: Create required devices on container startup"
      Revert "ve/devtmpfs: pass proper options string"
      Revert "devtmpfs: containerize it with new obj ns operation"
      Revert "fs: add data pointer to mount_ns()"
      Revert "devtmpfs: per-VE mounts introduced"
      devtmpfs: lightweight virtualization
    
    Reviewed-by: Cyrill Gorcunov <gorcu...@virtuozzo.com>
    
    ===
    This patch description:
    
    This reverts commit 5cd1d17ff1b6a8f476ab6f4cd0a6830fbffe43f2.
    
    We don't actually need separate null, zero, and other mem class devices
    inside a VE. The patch being reverted added them merely for kdevtmpfs to
    create nodes for this devices under /dev. This work can and should be
    done by vzctl on container start, so drop this patch.
    
    Signed-off-by: Vladimir Davydov <vdavy...@parallels.com>
---
 drivers/char/mem.c | 20 -------------------
 kernel/ve/ve.c     | 56 ------------------------------------------------------
 2 files changed, 76 deletions(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index c486c83..a3653f7 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -30,7 +30,6 @@
 #include <linux/io.h>
 #include <linux/aio.h>
 #include <linux/security.h>
-#include <linux/ve.h>
 
 #include <asm/uaccess.h>
 
@@ -924,20 +923,7 @@ static char *mem_devnode(struct device *dev, umode_t *mode)
        return NULL;
 }
 
-#ifdef CONFIG_VE
-static struct class mem_class_base = {
-       .name           = "mem",
-       .devnode        = mem_devnode,
-       .ns_type        = &ve_ns_type_operations,
-       .namespace      = ve_namespace,
-       .owner          = THIS_MODULE,
-};
-
-struct class *mem_class = &mem_class_base;
-EXPORT_SYMBOL(mem_class);
-#else
 static struct class *mem_class;
-#endif
 
 static int __init chr_dev_init(void)
 {
@@ -951,17 +937,11 @@ static int __init chr_dev_init(void)
        if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
                printk("unable to get major %d for memory devs\n", MEM_MAJOR);
 
-#ifdef CONFIG_VE
-       err = class_register(&mem_class_base);
-       if (err)
-               return err;
-#else
        mem_class = class_create(THIS_MODULE, "mem");
        if (IS_ERR(mem_class))
                return PTR_ERR(mem_class);
 
        mem_class->devnode = mem_devnode;
-#endif
        for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) {
                if (!devlist[minor].name)
                        continue;
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 4cd1f8b..cdbb342 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -413,55 +413,6 @@ static void ve_drop_context(struct ve_struct *ve)
        ve->init_cred = NULL;
 }
 
-static const struct {
-       unsigned int    minor;
-       char            *name;
-} ve_mem_class_devices[] = {
-       {3, "null"},
-       {5, "zero"},
-       {7, "full"},
-       {8, "random"},
-       {9, "urandom"},
-};
-
-extern struct class *mem_class;
-
-static int ve_init_mem_class(struct ve_struct *ve)
-{
-       struct device *dev;
-       dev_t devt;
-       size_t i;
-
-       for (i = 0; i < ARRAY_SIZE(ve_mem_class_devices); i++) {
-               devt = MKDEV(MEM_MAJOR, ve_mem_class_devices[i].minor);
-               dev = device_create(mem_class, NULL, devt,
-                                   ve, ve_mem_class_devices[i].name);
-               if (IS_ERR(dev)) {
-                       pr_err("Can't create %s (%d)\n",
-                              ve_mem_class_devices[i].name,
-                              (int)PTR_ERR(dev));
-                       for (; i > 0; i--) {
-                               devt = MKDEV(MEM_MAJOR, ve_mem_class_devices[i 
- 1].minor);
-                               device_destroy_namespace(mem_class, devt, ve);
-                       }
-                       return PTR_ERR(dev);
-               }
-       }
-
-       return 0;
-}
-
-static void ve_mem_class_fini(struct ve_struct *ve)
-{
-       dev_t devt;
-       size_t i;
-
-       for (i = 0; i < ARRAY_SIZE(ve_mem_class_devices); i++) {
-               devt = MKDEV(MEM_MAJOR, ve_mem_class_devices[i].minor);
-               device_destroy_namespace(mem_class, devt, ve);
-       }
-}
-
 /* under ve->op_sem write-lock */
 int ve_start_container(struct ve_struct *ve)
 {
@@ -510,10 +461,6 @@ int ve_start_container(struct ve_struct *ve)
        if (err)
                goto err_tty_console;
 
-       err = ve_init_mem_class(ve);
-       if (err)
-               goto err_mem_class;
-
        err = ve_hook_iterate_init(VE_SS_CHAIN, ve);
        if (err < 0)
                goto err_iterate;
@@ -527,8 +474,6 @@ int ve_start_container(struct ve_struct *ve)
        return 0;
 
 err_iterate:
-       ve_mem_class_fini(ve);
-err_mem_class:
        ve_tty_console_fini(ve);
 err_tty_console:
        ve_unix98_pty_fini(ve);
@@ -569,7 +514,6 @@ void ve_stop_ns(struct pid_namespace *pid_ns)
        ve_tty_console_fini(ve);
        ve_unix98_pty_fini(ve);
        ve_legacy_pty_fini(ve);
-       ve_mem_class_fini(ve);
 
        ve_fini_devtmpfs(ve);
 
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to