[Devel] [PATCH RHEL7 COMMIT] ve/tty: vtty -- Drop TTY_PINNED_BY_OTHER bit

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 24 08:08:48 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.3
------>
commit aed32620000ba36f3eafc0a336674c8715cf9bf9
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Thu Mar 24 19:08:47 2016 +0400

    ve/tty: vtty -- Drop TTY_PINNED_BY_OTHER bit
    
    This bit was introduced during our vttys code rework but eventually
    we don't need it, plain comparision with slave vtty driver is enough.
    So lets drop it off since it might conflict with some new tty bits
    in future.
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
    Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 drivers/tty/n_tty.c |  4 ++--
 drivers/tty/pty.c   | 11 +++++------
 include/linux/tty.h |  3 ---
 include/linux/ve.h  |  1 +
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 929aba4d..804de51 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -50,6 +50,7 @@
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ratelimit.h>
+#include <linux/ve.h>
 
 
 /* number of characters left in xmit buffer before select has we have room */
@@ -2043,8 +2044,7 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
 		}
 #ifdef CONFIG_VE
 		if (tty_hung_up_p(file) ||
-		    (tty->link && !tty->link->count &&
-		     !(test_bit(TTY_PINNED_BY_OTHER, &tty->link->flags)))) {
+		    (tty->link && !tty->link->count && !vtty_is_master(tty->link))) {
 #else
 		if (tty_hung_up_p(file) || (tty->link && !tty->link->count)) {
 #endif
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 92dd4ae..eda03d2 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -857,6 +857,11 @@ static struct file_operations vtty_fops;
 
 #define vtty_match_index(idx)	((idx) >= 0 && (idx) < MAX_NR_VTTY_CONSOLES)
 
+bool vtty_is_master(struct tty_struct *tty)
+{
+	return tty->driver == vttym_driver;
+}
+
 typedef struct {
 	envid_t			veid;
 	struct tty_struct	*vttys[MAX_NR_VTTY_CONSOLES];
@@ -1038,12 +1043,6 @@ static int vtty_install(struct tty_driver *driver, struct tty_struct *tty)
 	tty->link = peer;
 	peer->link = tty;
 
-	/*
-	 * Defer master closing if a slave peer
-	 * will be alive at this moment.
-	 */
-	set_bit(TTY_PINNED_BY_OTHER, &peer->flags);
-
 	vtty_map_set(map, tty);
 	return 0;
 
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d3d9a59..c3c000d 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -320,9 +320,6 @@ struct tty_file_private {
 #define TTY_HUPPING 		21	/* ->hangup() in progress */
 #define TTY_LDISC_HALTED	22	/* Line discipline is halted */
 #define TTY_CHARGED		23	/* Charged as ub resource */
-#ifdef CONFIG_VE
-#define TTY_PINNED_BY_OTHER	24	/* TTY is pinned by other link end, defer closing */
-#endif
 
 #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
 
diff --git a/include/linux/ve.h b/include/linux/ve.h
index e603d9e..2d0c19e 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -225,6 +225,7 @@ extern struct tty_driver *vtty_console_driver(int *index);
 extern int vtty_open_master(envid_t veid, int idx);
 extern void vtty_release(struct tty_struct *tty, struct tty_struct *o_tty,
 			 int *tty_closing, int *o_tty_closing);
+extern bool vtty_is_master(struct tty_struct *tty);
 #endif /* CONFIG_TTY */
 
 static inline int ve_mount_allowed(void)


More information about the Devel mailing list