linux/drivers
Dave Young f278a2f7bb tty: Fix regressions caused by commit b50989dc
The following commit made console open fails while booting:

	commit b50989dc44
	Author: Alan Cox <alan@linux.intel.com>
	Date:   Sat Sep 19 13:13:22 2009 -0700

	tty: make the kref destructor occur asynchronously

Due to tty release routines run in a workqueue now, error like the
following will be reported while booting:

INIT open /dev/console Input/output error

It also causes hibernation regression to appear as reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14229

The reason is that now there's latency issue with closing, but when
we open a "closing not finished" tty, -EIO will be returned.

Fix it as per the following Alan's suggestion:

  Fun but it's actually not a bug and the fix is wrong in itself as
  the port may be closing but not yet being destructed, in which case
  it seems to do the wrong thing.  Opening a tty that is closing (and
  could be closing for long periods) is supposed to return -EIO.

  I suspect a better way to deal with this and keep the old console
  timing is to split tty->shutdown into two functions.

  tty->shutdown() - called synchronously just before we dump the tty
  onto the waitqueue for destruction

  tty->cleanup() - called when the destructor runs.

  We would then do the shutdown part which can occur in IRQ context
  fine, before queueing the rest of the release (from tty->magic = 0
  ...  the end) to occur asynchronously

  The USB update in -next would then need a call like

       if (tty->cleanup)
               tty->cleanup(tty);

  at the top of the async function and the USB shutdown to be split
  between shutdown and cleanup as the USB resource cleanup and final
  tidy cannot occur synchronously as it needs to sleep.

  In other words the logic becomes

       final kref put
               make object unfindable

       async
               clean it up

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
[ rjw: Rebased on top of 2.6.31-git, reworked the changelog. ]
Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
[ Changed serial naming to match new rules, dropped tty_shutdown as per
  comments from Alan Stern  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-27 13:35:16 -07:00
..
accessibility
acpi ACPI: kill "unused variable ‘i’" warning 2009-09-27 11:58:36 -07:00
amba
ata
atm
auxdisplay
base
block Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2009-09-23 09:23:45 -07:00
bluetooth
cdrom sysctl: remove "struct file *" argument of ->proc_handler 2009-09-24 07:21:04 -07:00
char tty: Fix regressions caused by commit b50989dc 2009-09-27 13:35:16 -07:00
clocksource
connector proc connector: add event for process becoming session leader 2009-09-23 07:39:29 -07:00
cpufreq
cpuidle
crypto
dca
dio
dma
edac edac: core: remove completion-wait for complete with rcu_barrier 2009-09-24 07:21:05 -07:00
eisa
firewire Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2009-09-23 09:43:22 -07:00
firmware
gpio Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2009-09-23 09:30:48 -07:00
gpu const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
hid
hwmon Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2009-09-23 15:20:16 -07:00
i2c ACPI: i2c-scmi: don't use acpi_device_uid() 2009-09-26 01:42:07 -04:00
ide Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2009-09-23 09:32:11 -07:00
idle
ieee1394 const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
ieee802154
infiniband const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
input input: fix build failures caused by Kconfig Winbond WPCD376I Consumer IR hardware driver Kconfig entry 2009-09-24 07:20:56 -07:00
isdn seq_file: constify seq_operations 2009-09-23 07:39:29 -07:00
leds Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds 2009-09-26 10:50:47 -07:00
lguest Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2009-09-23 09:23:45 -07:00
macintosh Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds 2009-09-26 10:50:47 -07:00
mca
md
media const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
memstick memstick: move dev_dbg 2009-09-24 07:21:05 -07:00
message
mfd mfd/gpio: add a GPIO interface to the UCB1400 MFD chip driver via gpiolib 2009-09-23 07:39:48 -07:00
misc const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
mmc Merge branch 'origin' into for-linus 2009-09-24 21:22:33 +01:00
mtd Merge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze 2009-09-24 09:01:44 -07:00
net headers: kref.h redux 2009-09-26 10:17:19 -07:00
nubus
of of: remove "stm,m25p40" alias 2009-09-23 07:39:43 -07:00
oprofile cpumask: use zalloc_cpumask_var() where possible 2009-09-24 09:34:24 +09:30
parisc
parport sysctl: remove "struct file *" argument of ->proc_handler 2009-09-24 07:21:04 -07:00
pci ACPICA: fixup after acpi_get_object_info() change 2009-09-25 14:24:22 -04:00
pcmcia Merge branch 'origin' into for-linus 2009-09-24 21:22:33 +01:00
platform thinkpad-acpi: fix CONFIG_THINKPAD_ACPI_HOTKEY_POLL build problem 2009-09-27 02:13:06 -04:00
pnp ACPI: remove acpi_device.flags.hardware_id 2009-09-25 15:09:48 -04:00
power
pps
ps3
rapidio
regulator
rtc Merge branch 'origin' into for-linus 2009-09-24 21:22:33 +01:00
s390 headers: utsname.h redux 2009-09-23 18:13:10 -07:00
sbus
scsi const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
serial Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2009-09-24 17:22:31 -07:00
sfi
sh
sn
spi Merge branch 'origin' into for-linus 2009-09-24 21:22:33 +01:00
ssb ssb/sdio: fix printk format warnings 2009-09-23 11:35:41 -04:00
staging Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-09-24 15:13:11 -07:00
tc
telephony
thermal
uio const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
usb tty: Fix regressions caused by commit b50989dc 2009-09-27 13:35:16 -07:00
uwb
video const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
virtio
vlynq drivers/vlynq/vlynq.c: fix resource size off by 1 error 2009-09-24 07:21:05 -07:00
w1
watchdog [WATCHDOG] Add support for the Avionic Design Xanthos watchdog timer. 2009-09-25 08:38:16 +00:00
xen
zorro
Kconfig
Makefile Merge git://git.infradead.org/mtd-2.6 2009-09-23 10:07:49 -07:00