[Devel] [PATCH rh7 1/6] Revert "ve/devtmpfs: Create required devices on container startup"
Vladimir Davydov
vdavydov at parallels.com
Thu Jul 23 08:09:58 PDT 2015
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 <vdavydov at 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 c486c83be428..a3653f746a08 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 64967273b21a..c5fdf382ac93 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);
--
2.1.4
More information about the Devel
mailing list