]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
n_tty: Always wake up read()/poll() if new input
authorPeter Hurley <peter@hurleysoftware.com>
Sun, 10 Jan 2016 05:45:08 +0000 (21:45 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jan 2016 19:58:02 +0000 (11:58 -0800)
commit33d7136336a94feade73b08b9c4bd1420df4e572
tree7ed8129336075d0d82880b386bd84298ee8ec7fa
parent55b6314a17e8ad53233e9d0ebf6328734720e93b
n_tty: Always wake up read()/poll() if new input

A read() in non-canonical mode when VMIN > 0 and VTIME == 0 does not
complete until at least VMIN chars have been read (or the user buffer is
full). In this infrequent read mode, n_tty_read() attempts to reduce
wakeups by computing the amount of data still necessary to complete the
read (minimum_to_wake) and only waking the read()/poll() when that much
unread data has been processed. This is the only read mode for which
new data does not necessarily generate a wakeup.

However, this optimization is broken and commonly leads to hung reads
even though the necessary amount of data has been received. Since the
optimization is of marginal value anyway, just remove the whole
thing. This also remedies a race between a concurrent poll() and
read() in this mode, where the poll() can reset the minimum_to_wake
of the read() (and vice versa).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c