• Matthew Dharm's avatar
    [PATCH] USB Storage: close a race condition in disconnect near probe · 77f46328
    Matthew Dharm authored
    This patch started life as as533, and has been re-diffed against the
    current tree.
    
    Disconnect processing in usb-storage naturally divides into two parts:
    one to quiesce the driver (make sure no commands are executing or
    queued) and remove the host, and the other to deallocate all the USB and
    non-USB resources.  This patch creates two subroutines to handle those
    two parts.  Mostly it's just code movement, but there is one significant
    change.  If the scsi-scanning thread fails to initialize but the host
    has successfully been added, we need to quiesce the driver before
    removing the host.  After all, it's possible that scanning could have
    been initiated from somewhere else, such as userspace -- very low
    probability, but it's easily handled by calling the new subroutine.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    77f46328
usb.c 30.5 KB