[PATCH] uas: Unblock scsi-requests on failure to alloc streams in post_reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we return 1 from our post_reset handler, then our disconnect handler
will be called immediately afterwards. Since pre_reset blocks all scsi
requests our disconnect handler will then hang in the scsi_remove_host
call.

This is esp. bad because our disconnect handler hanging for ever also
stops the USB subsys from enumerating any new USB devices, causes commands
like lsusb to hang, etc.

In practice this happens when unplugging some uas devices because the hub
code may see the device as needing a warm-reset and calls usb_reset_device
before seeing the disconnect. In this case uas_configure_endpoints fails
with -ENODEV. We do not want to print an error for this, so this commit
also silences the shost_printk for -ENODEV.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1531966
Cc: stable@xxxxxxxxxxxxxxx
Fixes: 8d51444cdd06 ("uas: Not being able to alloc streams ... is an error")
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
 drivers/usb/storage/uas.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 5d04c40ee40a..5471422aa1ab 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -1077,9 +1077,13 @@ static int uas_post_reset(struct usb_interface *intf)
 
 	err = uas_configure_endpoints(devinfo);
 	if (err) {
-		shost_printk(KERN_ERR, shost,
-			     "%s: alloc streams error %d after reset",
-			     __func__, err);
+		if (err != -ENODEV) {
+			shost_printk(KERN_ERR, shost,
+				     "%s: alloc streams error %d after reset",
+				     __func__, err);
+		}
+		/* So that scsi_remove_host in uas_disconnect does not hang */
+		scsi_unblock_requests(shost);
 		return 1;
 	}
 
-- 
2.14.3




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux