]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - include/linux/tty.h
tty: Don't block on IO when ldisc change is pending
authorDmitry Safonov <dima@arista.com>
Tue, 8 Jan 2019 20:28:10 +0000 (18:28 -0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
commitcb4321d2574b22df1e2fe0c14877267c5223fe13
treee9caf8b8ca341bb52a2d42b8037ea15cbe1ad542
parent5a2be69bcbc0e3a2ac912653a81d27f46585a3d5
tty: Don't block on IO when ldisc change is pending

BugLink: https://bugs.launchpad.net/bugs/1791758
There might be situations where tty_ldisc_lock() has blocked, but there
is already IO on tty and it prevents line discipline changes.
It might theoretically turn into dead-lock.

Basically, provide more priority to pending tty_ldisc_lock() than to
servicing reads/writes over tty.

User-visible issue was reported by Mikulas where on pa-risc with
Debian 5 reboot took either 80 seconds, 3 minutes or 3:25 after proper
locking in tty_reopen().

Cc: Jiri Slaby <jslaby@suse.com>
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c96cf923a98d1b094df9f0cf97a83e118817e31b)
Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Souza <kleber.souza@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/tty/n_hdlc.c
drivers/tty/n_r3964.c
drivers/tty/n_tty.c
drivers/tty/tty_ldisc.c
include/linux/tty.h