[Devel] [PATCH RHEL7 COMMIT] ve/devpts: Revert 2c27d20125f5
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 28 03:14:08 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 99a71c6ceb41b6c8256620c4db844f7395f2a2c9
Author: Cyrill Gorcunov <gorcunov at gmail.com>
Date: Fri Aug 28 14:14:08 2015 +0400
ve/devpts: Revert 2c27d20125f5
Here we revert 2c27d20125f5 (ve/devpts: cleanup per-VE creation)
making code close to the vanilla one. We've tune devpts code a bit though in
next patch but less intrusive.
https://jira.sw.ru/browse/PSBM-34931
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Vladimir Davydov <vdavydov 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 | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 3dcd4da..be0fb74 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -402,6 +402,20 @@ fail:
}
#ifdef CONFIG_DEVPTS_MULTIPLE_INSTANCES
+static int test_devpts_sb(struct super_block *s, void *p)
+{
+ return get_exec_env()->devpts_sb == s;
+}
+
+static int set_devpts_sb(struct super_block *s, void *p)
+{
+ int error = set_anon_super(s, p);
+ if (!error) {
+ atomic_inc(&s->s_active);
+ get_exec_env()->devpts_sb = s;
+ }
+ return error;
+}
/*
* devpts_mount()
@@ -436,7 +450,6 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type,
int error;
struct pts_mount_opts opts;
struct super_block *s;
- struct dentry *root;
error = parse_mount_options(data, PARSE_MOUNT, &opts);
if (error)
@@ -450,29 +463,29 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type,
return ERR_PTR(-EINVAL);
if (opts.newinstance)
- root = mount_nodev(fs_type, flags, data, devpts_fill_super);
+ s = sget(fs_type, NULL, set_anon_super, flags, NULL);
else
- root = mount_ns(fs_type, flags, data, get_exec_env(), devpts_fill_super);
+ s = sget(fs_type, test_devpts_sb, set_devpts_sb, flags, NULL);
+
+ if (IS_ERR(s))
+ return ERR_CAST(s);
- if (IS_ERR(root))
- return ERR_CAST(root);
+ if (!s->s_root) {
+ error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0);
+ if (error)
+ goto out_undo_sget;
+ s->s_flags |= MS_ACTIVE;
+ }
- s = root->d_sb;
memcpy(&(DEVPTS_SB(s))->mount_opts, &opts, sizeof(opts));
error = mknod_ptmx(s);
if (error)
goto out_undo_sget;
- if (!opts.newinstance) {
- atomic_inc(&s->s_active);
- get_exec_env()->devpts_sb = s;
- }
-
- return root;
+ return dget(s->s_root);
out_undo_sget:
- dput(root);
deactivate_locked_super(s);
return ERR_PTR(error);
}
More information about the Devel
mailing list