]> err.no Git - linux-2.6/commit
usb-storage: fix bugs in the disconnect pathway
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 16 Aug 2007 20:16:00 +0000 (16:16 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 22 Aug 2007 21:27:52 +0000 (14:27 -0700)
commit2f67cd5b1d5066d11761aebb0bf4b76bc253cc99
tree937b0f53c025ea429d0814c6200322b3460487a7
parentfa0de2b614ca89d14d046e6756ba020fd386ff71
usb-storage: fix bugs in the disconnect pathway

This patch (as961) fixes a couple of bugs in the disconnect pathway of
usb-storage.

The first problem, which apparently has been around for a while
although nobody noticed it, shows up when an aborted command is still
pending when a disconnect occurs.  The SCSI error-handler will
continue to wait in command_abort() until the us->notify completion is
signalled.  Thus quiesce_and_remove_host() needs to signal it.

The second problem was introduced recently along with autosuspend
support.  Since usb_stor_scan_thread() now calls
usb_autopm_put_interface() before exiting, we can't simply leave the
scanning thread running after a disconnect; we must wait until the
thread exits.  This is solved by adding a new struct completion to the
private data structure.  Fortuitously, it allows the removal of the
rather clunky mechanism used in the past to insure that all threads
have finished before the module is unloaded.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/usb.c
drivers/usb/storage/usb.h