[Devel,RHEL7,COMMIT] tty: Fix task hang if one of peers is sitting in read

Submitted by Vladimir Davydov on Aug. 24, 2016, 12:01 p.m.

Details

Message ID 201608241201.u7OC1gBi004357@vdavydov-rh7.day.sw.ru
State New
Series "tty: Fix task hang if one of peers is sitting in read"
Headers show

Commit Message

Vladimir Davydov Aug. 24, 2016, 12:01 p.m.
The commit is pushed to "branch-rh7-3.10.0-327.28.2.vz7.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.28.2.vz7.17.3
------>
commit a7fb20c4cd83a1add67efe3edaa8500cc6edc6d1
Author: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Date:   Wed Aug 24 16:01:42 2016 +0400

    tty: Fix task hang if one of peers is sitting in read
    
    We reverted the former fix (ae93b8e96941c9ad) in commit 9539e4b2c5eee61f
    but the changes ported by rh team eventually are still not enough.
    So bring ae93b8e96941c9ad back.
    
    https://jira.sw.ru/browse/PSBM-51273
    
    Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
    CC: Igor Sukhih <igor@virtuozzo.com>
    CC: Vladimir Davydov <vdavydov@virtuozzo.com>
    CC: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 drivers/tty/tty_ldisc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index fd2b20d6af80..4c82aaad8566 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -685,7 +685,7 @@  void tty_ldisc_hangup(struct tty_struct *tty)
 	 *
 	 * Avoid racing set_ldisc or tty_ldisc_release
 	 */
-	tty_ldisc_lock_pair(tty, tty->link);
+	tty_ldisc_lock(tty, MAX_SCHEDULE_TIMEOUT);
 
 	if (tty->ldisc) {
 
@@ -707,7 +707,7 @@  void tty_ldisc_hangup(struct tty_struct *tty)
 			WARN_ON(tty_ldisc_open(tty, tty->ldisc));
 		}
 	}
-	tty_ldisc_enable_pair(tty, tty->link);
+	tty_ldisc_unlock(tty);
 	if (reset)
 		tty_reset_termios(tty);