[PATCH v2 00/10] Rework tty_reopen()

From: Peter Hurley
Date: Sun Jan 10 2016 - 00:14:59 EST

Hi Greg,

I re-ordered the patches in this series because the first two patches
fix regressions in 4.4-rc. (I did not originally write the patches
to fix regressions; that's just how it turned out).

Obviously, it's too late for those to make 4.4 but at least this way
they're ready for 4.4.1 stable.

Also, Herton Krzesinski brought to my attention a long-resident problem
with releasing the devpts index when the last file reference is /dev/tty.
Since that impacted the tty driver remove() method changes, I just
removed those patches from this series.

original message follows:

This patch series implements two important improvements to tty open()
behavior: interruptible open() and automatic retry when tty teardown
has already commenced.

Interruptible open() allows signals to cancel the open wait if stalled
waiting for tty teardown to complete.

Automatic retry of tty open() when racing a tty teardown now makes tty
open() fully POSIX compliant. For some time, the Linux kernel has
returned EIO from open() under certain circumstances. This happens when
tty_open() observes a valid tty from driver lookup but the tty is
being released (in final close) and teardown is about to commence.

The observable userspace change is that userspace will no longer need
to retry open() on EIO error.

This series also continues the ongoing effort to cleanup and reduce the
kernel tty interface.


Peter Hurley (10):
tty: Wait interruptibly for tty lock on reopen
tty: Retry failed reopen if tty teardown in-progress
tty: Fix ldisc leak in failed tty_init_dev()
tty: Remove !tty check from free_tty_struct()
tty: Fix tty_init_termios() declaration
tty: Re-declare tty_driver_remove_tty() file scope
pty: Remove pty_unix98_shutdown()
tty: Remove __lockfunc annotation from tty lock functions
tty: Consolidate noctty checks in tty_open()
tty: Refactor tty_open()

drivers/tty/pty.c | 27 +------
drivers/tty/tty_io.c | 174 ++++++++++++++++++++++---------------------
drivers/tty/tty_ldisc.c | 21 +++---
drivers/tty/tty_mutex.c | 16 +++-
drivers/usb/serial/console.c | 6 +-
include/linux/tty.h | 16 ++--
6 files changed, 121 insertions(+), 139 deletions(-)