[Devel] [PATCH RHEL8 COMMIT] ve/vtty: n_tty -- Allow write on sole slave vtty peer
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jul 26 20:15:26 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.el8
------>
commit 4a01fdf350fe13065c788878ac1b0805b1dc9ce8
Author: Cyrill Gorcunov <gorcunov at odin.com>
Date: Mon Jul 26 20:15:26 2021 +0300
ve/vtty: n_tty -- Allow write on sole slave vtty peer
In pcs6 the pty counting has been somewhat sophisticated so in
pcs7 we've simplified it to bring as less changes into vanilla
code as possible (introducing TTY_PINNED_BY_OTHER bit to order
closing sequence). The new accounting works as expected but
there is a small issue -- until master peer get a real user hooked
on it (say containers opens /dev/console on its own and writes
log into it) any write operation return -EIO because line
discipline module tests the @count on the other side of a peer.
I think we can add one small code snippet (just the same
as we did in tty_release() helper to track such situation
and allow to write into sole open vtty.
Basically the issue were that getty inside container wrote
some data upon container's starup and connection from the
node simply didn't get it because data was lost which as
a side effect forced a console user to hit "enter" second
time.
https://jira.sw.ru/browse/PSBM-40740
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
CC: Igor Sukhih <igor at parallels.com>
CC: Nikolay Breykin <nbreykin at odin.com>
https://jira.sw.ru/browse/PSBM-132299
(cherry-picked from b84f8d5546698afeb04011f8f24ea548284ae742)
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
drivers/tty/n_tty.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 3ad460219fd6..202ef49efe88 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2322,7 +2322,13 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
retval = -ERESTARTSYS;
break;
}
+#ifdef CONFIG_VE
+ if (tty_hung_up_p(file) ||
+ (tty->link && !tty->link->count &&
+ !(test_bit(TTY_PINNED_BY_OTHER, &tty->link->flags)))) {
+#else
if (tty_hung_up_p(file) || (tty->link && !tty->link->count)) {
+#endif
retval = -EIO;
break;
}
More information about the Devel
mailing list