Skip to content

Rework tty_reopen()

Peter Hurley linux-um lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 4 repliesIn review
  2. v112 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10tty: Wait interruptibly for tty lock on reopendrivers/tty/tty_io.c drivers/tty/tty_mutex.c include/linux/tty.h+16 -10 replies
2/10tty: Retry failed reopen if tty teardown in-progressdrivers/tty/tty_io.c+8 -40 replies
3/10tty: Fix ldisc leak in failed tty_init_dev()drivers/tty/pty.c drivers/tty/tty_io.c drivers/tty/tty_ldisc.c +1 more+8 -230 replies
4/10tty: Remove !tty check from free_tty_struct()drivers/tty/tty_io.c+0 -20 replies
5/10tty: Fix tty_init_termios() declarationdrivers/tty/pty.c drivers/tty/tty_io.c drivers/usb/serial/console.c +1 more+9 -291 reply
6/10tty: Re-declare tty_driver_remove_tty() file scopedrivers/tty/tty_io.c include/linux/tty.h+1 -30 replies
7/10pty: Remove pty_unix98_shutdown()drivers/tty/pty.c+1 -100 replies
8/10tty: Remove __lockfunc annotation from tty lock functionsdrivers/tty/tty_ldisc.c drivers/tty/tty_mutex.c include/linux/tty.h+15 -170 replies
9/10tty: Consolidate noctty checks in tty_open()drivers/tty/tty_io.c+8 -93 replies
10/10tty: Refactor tty_open()drivers/tty/tty_io.c+67 -530 replies

Reviews trailers per patch

1 of 10 patches has a Reviewed-by or Acked-by.

PatchJohan Hovold
1/10
2/10
3/10
4/10
5/10A-b
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/10] Rework tty_reopen()

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.

Regards,

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(-)
Signature · 1 line
2.7.0