linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: uas: fix usb subsystem hang after power off hub port
@ 2019-03-08  9:13 Kento.A.Kobayashi
  2019-03-08 16:52 ` Oliver Neukum
  0 siblings, 1 reply; 30+ messages in thread
From: Kento.A.Kobayashi @ 2019-03-08  9:13 UTC (permalink / raw)
  To: oneukum, stern, gregkh; +Cc: linux-usb, linux-scsi, usb-storage, linux-kernel

The issue happens with following steps:
Access usb3.0/3.1 device that uses uas driver.
Power off hub port connecting device by ioctl(USBDEVFS_CONTROL).
Wait longer than 30s(scsi layer timeout period is 30s).
Execute commands like lsusb, no response and usb subsytem hangs.

After scsi layer timeout, uas_eh_bus_reset_handler works and enter
usb_reset_device. During reset, current uas_post_reset returns 1 if
uas_configure_endpoints fails with -ENODEV, then it tries to rebind
uas driver. The unbind request cannot complete because program goes
to host_not_ready in scsi_request_fn. As result, it stops at device
reset process and the lock took before reset will not be released.

The usb_reset_and_verify_device included in usb_reset_device fails
with -ENODEV after power off hub port, and the -ENODEV error will
be reported to uas_eh_bus_reset_handler and upper layer, so it
doesn't need to do rebind if -ENODEV happens.

Signed-off-by: Kento Kobayashi <Kento.A.Kobayashi@sony.com>
---
drivers/usb/storage/uas.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 36742e8..24b09fd 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -1116,6 +1116,9 @@ static int uas_post_reset(struct usb_interface *intf)

        scsi_unblock_requests(shost);

+       if (err == -ENODEV)
+               return 0;
+
        return err ? 1 : 0;
 }

-- 
2.7.4

^ permalink raw reply related	[flat|nested] 30+ messages in thread
[parent not found: <16EA1F625E922C43B00B9D8225022050086961B5@APYOKXMS108.ap.sony.com>]

end of thread, other threads:[~2019-04-16  2:32 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  9:13 [PATCH] usb: uas: fix usb subsystem hang after power off hub port Kento.A.Kobayashi
2019-03-08 16:52 ` Oliver Neukum
2019-03-08 17:33   ` Alan Stern
2019-03-11  8:36   ` Kento.A.Kobayashi
2019-03-12 15:37     ` Oliver Neukum
2019-03-15  2:28       ` Kento.A.Kobayashi
2019-03-25 10:21         ` Kento.A.Kobayashi
2019-03-25 10:34           ` Oliver Neukum
2019-03-28  7:53             ` Kento.A.Kobayashi
2019-03-28 15:15               ` Oliver Neukum
2019-03-28 15:57                 ` Alan Stern
2019-03-28 16:49                   ` Oliver Neukum
2019-03-29 14:13                     ` Alan Stern
2019-04-02  0:28                 ` Kento.A.Kobayashi
2019-04-02 14:38                   ` Alan Stern
2019-04-04  3:57                     ` Kento.A.Kobayashi
2019-04-04 19:33                       ` Alan Stern
2019-04-09  0:28                         ` Kento.A.Kobayashi
2019-04-09  1:21                           ` Alan Stern
2019-04-09  2:10                         ` Martin K. Petersen
2019-04-09 14:44                           ` Alan Stern
2019-04-09 15:16                             ` Bart Van Assche
2019-04-09 16:45                               ` Alan Stern
2019-04-15  0:27                                 ` Kento.A.Kobayashi
2019-04-15 15:18                                   ` Alan Stern
2019-04-15 15:32                                     ` Alan Stern
2019-04-16  2:31                                       ` Kento.A.Kobayashi
2019-04-10  2:11                               ` Martin K. Petersen
     [not found] <16EA1F625E922C43B00B9D8225022050086961B5@APYOKXMS108.ap.sony.com>
2019-03-04  6:23 ` Greg KH
2019-03-04  7:19   ` Jacky.Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).