[Devel] [PATCH RHEL7 COMMIT] Revert "devtmpfs: per-VE mounts introduced"
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 28 05:10:59 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 3fd8ef28e629c3ec00144f83249628244903876d
Author: Vladimir Davydov <vdavydov at parallels.com>
Date: Fri Aug 28 16:10:58 2015 +0400
Revert "devtmpfs: per-VE mounts introduced"
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 <gorcunov at virtuozzo.com>
===
This patch description:
This reverts commit e85a799b629d5e28c8931ddd9127cf18d501745c.
More devtmpfs virtualization crap to drop. Will be reworked.
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
Conflicts:
include/linux/ve.h
kernel/ve/ve.c
---
drivers/base/devtmpfs.c | 28 ++--------------------------
include/linux/device.h | 4 ----
include/linux/ve.h | 3 ---
kernel/ve/ve.c | 8 --------
4 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 6f4ba37..f59b798 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -23,8 +23,6 @@
#include <linux/ramfs.h>
#include <linux/slab.h>
#include <linux/kthread.h>
-#include <linux/fs_struct.h>
-#include <linux/ve.h>
#include "base.h"
static struct task_struct *thread;
@@ -59,9 +57,9 @@ static struct dentry *dev_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data)
{
#ifdef CONFIG_TMPFS
- return mount_ns(fs_type, flags, data, shmem_fill_super);
+ return mount_single(fs_type, flags, data, shmem_fill_super);
#else
- return mount_ns(fs_type, flags, data, ramfs_fill_super);
+ return mount_single(fs_type, flags, data, ramfs_fill_super);
#endif
}
@@ -387,7 +385,6 @@ static int devtmpfsd(void *p)
goto out;
sys_chdir("/.."); /* will traverse into overmounted root */
sys_chroot(".");
- get_fs_root(current->fs, &get_exec_env()->devtmpfs_root);
complete(&setup_done);
while (1) {
spin_lock(&req_lock);
@@ -408,33 +405,12 @@ static int devtmpfsd(void *p)
spin_unlock(&req_lock);
schedule();
}
- path_put(&get_exec_env()->devtmpfs_root);
return 0;
out:
complete(&setup_done);
return *err;
}
-int ve_init_devtmpfs(void *data)
-{
- struct ve_struct *ve = data;
- struct vfsmount *mnt;
-
- mnt = kern_mount_data(&dev_fs_type, ve);
- if (IS_ERR(mnt))
- return PTR_ERR(mnt);
- ve->devtmpfs_root.mnt = mnt;
- ve->devtmpfs_root.dentry = mnt->mnt_root;
- return 0;
-}
-
-void ve_fini_devtmpfs(void *data)
-{
- struct ve_struct *ve = data;
-
- kern_unmount(ve->devtmpfs_root.mnt);
-}
-
/*
* Create devtmpfs instance, driver-core devices will add their device
* nodes here.
diff --git a/include/linux/device.h b/include/linux/device.h
index df5152f..2c9c764 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1005,14 +1005,10 @@ extern void put_device(struct device *dev);
extern int devtmpfs_create_node(struct device *dev);
extern int devtmpfs_delete_node(struct device *dev);
extern int devtmpfs_mount(const char *mntdir);
-extern int ve_init_devtmpfs(void *data);
-extern void ve_fini_devtmpfs(void *data);
#else
static inline int devtmpfs_create_node(struct device *dev) { return 0; }
static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
-static inline int ve_init_devtmpfs(void *data) { return 0; }
-static inline void ve_fini_devtmpfs(void *data) { }
#endif
/* drivers/base/power/shutdown.c */
diff --git a/include/linux/ve.h b/include/linux/ve.h
index 7ba3f92..84be823 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -134,9 +134,6 @@ struct ve_struct {
struct mutex devmnt_mutex;
struct kmapset_key ve_sysfs_perms;
-#if IS_ENABLED(CONFIG_DEVTMPFS)
- struct path devtmpfs_root;
-#endif
};
struct ve_devmnt {
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index cdbb342..536a83f 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -445,10 +445,6 @@ int ve_start_container(struct ve_struct *ve)
if (err)
goto err_umh;
- err = ve_init_devtmpfs(ve);
- if (err)
- goto err_dev;
-
err = ve_legacy_pty_init(ve);
if (err)
goto err_legacy_pty;
@@ -480,8 +476,6 @@ err_tty_console:
err_unix98_pty:
ve_legacy_pty_fini(ve);
err_legacy_pty:
- ve_fini_devtmpfs(ve);
-err_dev:
ve_stop_umh(ve);
err_umh:
ve_stop_kthread(ve);
@@ -515,8 +509,6 @@ void ve_stop_ns(struct pid_namespace *pid_ns)
ve_unix98_pty_fini(ve);
ve_legacy_pty_fini(ve);
- ve_fini_devtmpfs(ve);
-
ve_stop_umh(ve);
/*
* Stop kernel thread, or zap_pid_ns_processes() would wait it forever.
More information about the Devel
mailing list