lkml.org 
[lkml]   [2013]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 34/75] TTY: Fix tty miss restart after we turn off flow-control
    Date
    3.8.13.2 -stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Wang YanQing <udknight@gmail.com>

    commit dab73b4eb9ef924a2b90dab84e539076d82b256f upstream.

    I meet emacs hang in start if I do the operation below:
    1: echo 3 > /proc/sys/vm/drop_caches
    2: emacs BigFile
    3: Press CTRL-S follow 2 immediately

    Then emacs hang on, CTRL-Q can't resume, the terminal
    hang on, you can do nothing with this terminal except
    close it.

    The reason is before emacs takeover control the tty,
    we use CTRL-S to XOFF it. Then when emacs takeover the
    control, it may don't use the flow-control, so emacs hang.
    This patch fix it.

    This patch will fix a kind of strange tty relation hang problem,
    I believe I meet it with vim in ssh, and also see below bug report:
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=465823

    Signed-off-by: Wang YanQing <udknight@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Kamal Mostafa <kamal@canonical.com>
    ---
    drivers/tty/n_tty.c | 8 ++++++++
    1 file changed, 8 insertions(+)

    diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
    index 19083ef..9365978 100644
    --- a/drivers/tty/n_tty.c
    +++ b/drivers/tty/n_tty.c
    @@ -1587,6 +1587,14 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
    ldata->real_raw = 0;
    }
    n_tty_set_room(tty);
    + /*
    + * Fix tty hang when I_IXON(tty) is cleared, but the tty
    + * been stopped by STOP_CHAR(tty) before it.
    + */
    + if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) {
    + start_tty(tty);
    + }
    +
    /* The termios change make the tty ready for I/O */
    wake_up_interruptible(&tty->write_wait);
    wake_up_interruptible(&tty->read_wait);
    --
    1.8.1.2


    \
     
     \ /
      Last update: 2013-06-04 22:01    [W:4.322 / U:0.164 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site