1
0
Fork 0
alistair23-linux/drivers/tty
Peter Hurley 79c1faa451 tty: Remove tty_wait_until_sent_from_close()
tty_wait_until_sent_from_close() drops the tty lock while waiting
for the tty driver to finish sending previously accepted data (ie.,
data remaining in its write buffer and transmit fifo).

tty_wait_until_sent_from_close() was added by commit a57a7bf3fc
("TTY: define tty_wait_until_sent_from_close") to prevent the entire
tty subsystem from being unable to open new ttys while waiting for
one tty to close while output drained.

However, since commit 0911261d4c ("tty: Don't take tty_mutex for tty
count changes"), holding a tty lock while closing does not prevent other
ttys from being opened/closed/hung up, but only prevents lifetime event
changes for the tty under lock.

Holding the tty lock while waiting for output to drain does prevent
parallel non-blocking opens (O_NONBLOCK) from advancing or returning
while the tty lock is held. However, all parallel opens _already_
block even if the tty lock is dropped while closing and the parallel
open advances. Blocking in open has been in mainline since at least 2.6.29
(see tty_port_block_til_ready(); note the test for O_NONBLOCK is _after_
the wait while ASYNC_CLOSING).

IOW, before this patch a non-blocking open will sleep anyway for the
_entire_ duration of a parallel hardware shutdown, and when it wakes, the
error return will cause a release of its tty, and it will restart with
a fresh attempt to open. Similarly with a blocking open that is already
waiting; when it's woken, the hardware shutdown has already completed
to ASYNC_INITIALIZED is not set, which forces a release and restart as
well.

So, holding the tty lock across the _entire_ close (which is what this
patch does), even while waiting for output to drain, is equivalent to
the current outcome wrt parallel opens.

Cc: Alan Cox <alan@linux.intel.com>
Cc: David Laight <David.Laight@aculab.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Karsten Keil <isdn@linux-pingi.de>
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-17 21:11:29 -07:00
..
hvc tty: Remove tty_wait_until_sent_from_close() 2015-10-17 21:11:29 -07:00
ipwireless Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2015-04-14 09:50:27 -07:00
serial serial: tegra: Add helper function for handling RX buffer 2015-10-17 21:07:57 -07:00
vt tty: vt: Fix !TASK_RUNNING diagnostic warning from paste_selection() 2015-07-23 18:08:29 -07:00
Kconfig ttyFDC: Implement KGDB IO operations. 2015-03-31 12:04:13 +02:00
Makefile TTY: Add MIPS EJTAG Fast Debug Channel TTY driver 2015-03-31 12:04:12 +02:00
amiserial.c tty: amiserial.c: move assignment out of if () block 2015-05-10 19:04:16 +02:00
bfin_jtag_comm.c TTY: bfin_jtag_comm: remove incorrect wait_until_sent operation 2015-03-07 03:44:14 +01:00
cyclades.c tty: remove buf parameter from tty_name() 2015-05-06 22:26:57 +02:00
ehv_bytechan.c tty: remove unused variable sprop 2015-02-03 15:52:13 -08:00
goldfish.c staging: goldfish: Fix pointer cast for 32 bits 2015-05-31 11:40:14 +09:00
isicom.c tty/isicom: fix big-endian compile warning 2015-02-02 10:11:25 -08:00
metag_da.c tty/metag_da: Avoid module_init/module_exit in non-modular code 2015-06-16 14:12:31 -04:00
mips_ejtag_fdc.c MIPS: ttyFDC: replace IRQF_NO_SUSPEND with IRQF_COND_SUSPEND 2015-10-04 19:11:05 +01:00
moxa.c TTY: fix decimal printf format specifiers prefixed with 0x 2014-09-08 15:51:35 -07:00
moxa.h
mxser.c
mxser.h
n_gsm.c tty: Convert use of __constant_htons to htons 2015-07-23 15:10:25 -07:00
n_hdlc.c pty: Fix input race when closing 2015-05-10 19:26:37 +02:00
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c 2015-10-04 19:03:40 +01:00
nozomi.c drivers/tty/nozomi.c: rename CONFIG_MAGIC 2015-05-10 19:19:06 +02:00
pty.c drivers/tty: make pty.c slightly more explicitly non-modular 2015-10-04 17:27:56 +01:00
rocket.c TTY: fix misspelling of current function in string 2015-01-09 14:38:15 -08:00
rocket.h tty: rocket: fix comment of ROCKET_SPD_HI 2015-05-24 12:49:16 -07:00
rocket_int.h
synclink.c tty: synclink.c: move assignment out of if () block 2015-05-10 19:04:18 +02:00
synclink_gt.c tty: synclink_gt.c: move assignment out of if () block 2015-05-10 19:04:18 +02:00
synclinkmp.c tty: synclinkmp.c: move assignment out of if () block 2015-05-10 19:04:18 +02:00
sysrq.c drivers/tty: make sysrq.c slightly more explicitly non-modular 2015-10-04 17:27:56 +01:00
tty_audit.c audit: anchor all pid references in the initial pid namespace 2014-03-20 10:11:55 -04:00
tty_buffer.c tty: fix data race on tty_buffer.commit 2015-10-04 19:03:40 +01:00
tty_io.c drivers/tty: require read access for controlling terminal 2015-10-04 19:20:30 +01:00
tty_ioctl.c tty: Replace inline #ifdef TTY_DEBUG_WAIT_UNTIL_SENT 2015-07-23 18:37:31 -07:00
tty_ldisc.c tty: core: Improve ldisc debug messages 2015-07-23 18:37:31 -07:00
tty_ldsem.c tty: tty_ldsem.c: move assignment out of if () block 2015-05-10 19:04:18 +02:00
tty_mutex.c tty: Make lock subclasses available for other tty locks 2015-02-02 10:11:27 -08:00
tty_port.c tty: Remove tty_wait_until_sent_from_close() 2015-10-17 21:11:29 -07:00