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 953017eb9e8237859f63d7b0a2c816b7e7e5a615 Author: Vladimir Davydov <vdavy...@parallels.com> Date: Fri Aug 28 18:32:16 2015 +0400
ve/pty: create ptmx device per ve namespace Patchset description: Zap Unix98 pty virtualization Unix98 ptys are already virtualized on the VFS layer, nothing needs to be done on the driver's side. We don't even have this in PCS6. The patch set makes ptmx device system-wide while its class, tty_class, is still virtualized. Since it's now system-wide, we have to add its sysfs entry to ve.default_sysfs_permissions, but since its class is virtualized, we won't be able to do it (see sysfs_perms_set -> sysfs_find_dirent). As a result, if the container relies on sysfs while creating devnodes, it will not find ptmx and therefore fallback to legacy ptys, which we are going to drop. The last patch (ve/pty: create ptmx device per ve namespace) addresses this. === This patch description: After Unix98 PTY driver "virtualization" was reverted, we have to manually set sysfs permissions for ptmx. This, however, is currently impossible, because tty_class is still virtualized, which makes ve.sysfs_permissions ignore it (see sysfs_perms_set). This patch is a quick-fix which simply creates/destroys ptmx device in ve namespace on container start/stop. It must be dropped when commit 6022450d12653 ("ve/tty: make tty_class VE-namespace aware") is reverted. Signed-off-by: Vladimir Davydov <vdavy...@parallels.com> --- drivers/tty/pty.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index bd17a45..529046b 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -818,6 +818,32 @@ err_file: return retval; } +static int ve_unix98_pty_init(void *data) +{ + struct ve_struct *ve = data; + struct device *dev; + + dev = device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), ve, "ptmx"); + if (IS_ERR(dev)) { + pr_warn("Failed to create ptmx device for ve %s: %ld\n", + ve->ve_name, PTR_ERR(dev)); + return PTR_ERR(dev); + } + return 0; +} + +static void ve_unix98_pty_fini(void *data) +{ + device_destroy_namespace(tty_class, MKDEV(TTYAUX_MAJOR, 2), data); +} + +static struct ve_hook ve_unix98_pty_hook = { + .init = ve_unix98_pty_init, + .fini = ve_unix98_pty_fini, + .priority = HOOK_PRIO_DEFAULT, + .owner = THIS_MODULE, +}; + static struct file_operations ptmx_fops; static void __init unix98_pty_init(void) @@ -882,6 +908,7 @@ static void __init unix98_pty_init(void) register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) panic("Couldn't register /dev/ptmx driver"); device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); + ve_hook_register(VE_SS_CHAIN, &ve_unix98_pty_hook); } #else _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel