Bug 3595

Summary: usb mass storage devices hang open() when unplugged
Product: Drivers Reporter: John (J5) Palmieri (johnp)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Severity: normal CC: bunk
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.8-1 Tree: Mainline
Regression: ---
Bug Depends on:    
Bug Blocks: 5089    

Description John (J5) Palmieri 2004-10-19 10:48:39 UTC
Distribution: Fedora Rawhide
Hardware Environment: Dual Xeon Dell N Series
                      Intel 82801DB/DBL/DBM UHCI controler

Software Environment: Console

Problem Description: Programs that attempt to open a usb-storage device while it
is being pulled out will hang in the open call even if O_NONBLOCK is set.  This
becomes a problem for user space programs that poll devices to see if the media
has changed (such as USB floppies and CD-ROMS).  If a poll happens when the
device is yanked out the application doing the polling will freeze in the disk
wait state while the kernel continues to wait for a responce from the
non-existant USB device.  A test program and steps to reproduce have been posted
to RedHat's bugzilla at http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=136255

Here is the kernel backtrace of the test:

test          D 00000001  2916 13507  11606                     (NOTLB)
eda7dde8 00000082 00000000 00000001 f7f75670 00000003 f6fd132c f7f75670
       00000000 c18166c0 c1815d60 00000001 0000067c f488414c 000001ae f7f75670
       f2fe6920 f2fe6a88 00000000 eda7de54 eda7de58 eda7de54 eda7de04 eda7de3c
Call Trace:
 [<c02bfb8f>] wait_for_completion+0x94/0xcb
 [<c011cb6b>] default_wake_function+0x0/0xc
 [<f8bec093>] scsi_request_fn+0x2fa/0x30e [scsi_mod]
 [<c011cb6b>] default_wake_function+0x0/0xc
 [<f8beb1b3>] scsi_wait_req+0x5e/0x8c [scsi_mod]
 [<f8beb103>] scsi_wait_done+0x0/0x52 [scsi_mod]
 [<f8b27dc8>] sd_spinup_disk+0x66/0x266 [sd_mod]
 [<c02bfe40>] __cond_resched+0x14/0x39
 [<f8b28958>] sd_revalidate_disk+0xc5/0x126 [sd_mod]
 [<c015b3cc>] check_disk_change+0x3f/0x59
 [<f8b275ff>] sd_open+0x7a/0xf6 [sd_mod]
 [<c015b532>] do_open+0xe1/0x3b8
 [<c015b88b>] blkdev_open+0x1a/0x42
 [<c0153f83>] dentry_open+0xcd/0x1a5
 [<c0153eb0>] filp_open+0x36/0x3c
 [<c02bfe40>] __cond_resched+0x14/0x39
 [<c01b5a92>] direct_strncpy_from_user+0x3e/0x5d
 [<c01541af>] sys_open+0x31/0x7d
 [<c02c182b>] syscall_call+0x7/0xb
Comment 1 Adrian Bunk 2006-01-09 14:03:46 UTC
Is this issue still present in kernel 2.6.15?
Comment 2 John (J5) Palmieri 2006-02-15 07:23:47 UTC
I can't reproduce on 2.6.15-1.1948_FC5 (Fedora build).  Ran my test program and
yanked a couple of USB keys, several times, and could not get the module to get
Comment 3 Greg Kroah-Hartman 2006-02-15 08:37:52 UTC
Ok, closing then.