OpenCloudOS-Kernel/drivers/staging/dgrp
Peter Hurley e359a4e38d tty: Remove tty_hung_up_p() tests from tty drivers' open()
Since at least before 2.6.30, it has not been possible to observe
a hung up file pointer in a tty driver's open() method unless/until
the driver open() releases the tty_lock() (eg., before blocking).

This is because tty_open() adds the file pointer while holding
the tty_lock() _and_ doesn't release the lock until after calling
the tty driver's open() method. [ Before tty_lock(), this was
lock_kernel(). ]

Since __tty_hangup() first waits on the tty_lock() before
enumerating and hanging up the open file pointers, either
__tty_hangup() will wait for the tty_lock() or tty_open() will
not yet have added the file pointer. For example,

CPU 0                          |  CPU 1
                               |
tty_open                       |  __tty_hangup
  ..                           |    ..
  tty_lock                     |    ..
  tty_reopen                   |    tty_lock  / blocks
  ..                           |
  tty_add_file(tty, filp)      |
  ..                           |
  tty->ops->open(tty, filp)    |
    tty_port_open              |
      tty_port_block_til_ready |
        ..                     |
        while (1)              |
          ..                   |
          tty_unlock           |    / unblocks
          schedule             |    for each filp on tty->tty_files
                               |      f_ops = tty_hung_up_fops;
                               |    ..
                               |    tty_unlock
          tty_lock             |
  ..                           |
  tty_unlock                   |

Note that since tty_port_block_til_ready() and similar drop
the tty_lock while blocking, when woken, the file pointer
must then be tested for having been hung up.

Also, fix bit-rotted drivers that used extra_count to track the
port->count bump.

CC: Mikael Starvik <starvik@axis.com>
CC: Samuel Ortiz <samuel@sortiz.org>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-10 16:06:49 -07:00
..
Kconfig tty: Added a CONFIG_TTY option to allow removal of TTY 2013-01-18 16:15:27 -08:00
Makefile
README
TODO
dgrp_common.c dgrp procfs fixes, part 6: just use proc_create{,_data} 2013-04-09 14:13:09 -04:00
dgrp_common.h Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-05-01 17:51:54 -07:00
dgrp_dpa_ops.c staging: for dgrp, let nd_ps_desc always NUL terminated string within MAX_DESC_LEN length 2013-05-13 18:08:16 -04:00
dgrp_driver.c staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
dgrp_mon_ops.c Include missing linux/slab.h inclusions 2013-04-29 15:42:01 -04:00
dgrp_net_ops.c Revert "Staging: dgrp: Refactor the function dgrp_receive() in drrp_net_ops.c" 2014-02-07 09:16:38 -08:00
dgrp_ports_ops.c procfs: new helper - PDE_DATA(inode) 2013-04-09 14:13:32 -04:00
dgrp_specproc.c Include missing linux/slab.h inclusions 2013-04-29 15:42:01 -04:00
dgrp_sysfs.c /drivers/staging/dgrp: Fixed warning unchecked sscanf return value 2014-03-10 23:25:08 -07:00
dgrp_tty.c tty: Remove tty_hung_up_p() tests from tty drivers' open() 2014-07-10 16:06:49 -07:00
digirp.h
drp.h staging: for dgrp, let nd_ps_desc always NUL terminated string within MAX_DESC_LEN length 2013-05-13 18:08:16 -04:00

README

The user space code to work with this driver is located at
https://github.com/wfp5p/dgrp-utils