Created attachment 508478 [details, diff] 0001-usb-storage-Disable-UAS-on-JMicron-SATA-enclosure.patch This is a problem I am suffering for years, since I bought an external USB box for a hard disk. When the disk is used I see no issue, but when I leave it for some minutes idle, when I try to reuse, it fails and I need to disconnect and connect it again. I see this in dmesg when doing that sequence (at first connect, later leave it idle, then try to use it again -> errors are shown, then disconnect/connect again) [2568966.031710] sd 4:0:0:0: Attached scsi generic sg2 type 0 [2568966.035346] sd 4:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB) [2568966.035350] sd 4:0:0:0: [sdb] 4096-byte physical blocks [2568966.035969] sd 4:0:0:0: [sdb] Write Protect is off [2568966.035970] sd 4:0:0:0: [sdb] Mode Sense: 67 00 10 08 [2568966.037190] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA [2568966.089103] sdb: sdb1 [2568966.094858] sd 4:0:0:0: [sdb] Attached SCSI disk [2568966.587728] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null) [2572854.944832] sd 4:0:0:0: [sdb] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD OUT [2572854.944834] sd 4:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 74 44 94 d8 00 00 28 00 [2572854.944969] scsi host4: uas_eh_bus_reset_handler start [2572857.194864] usb 2-1: reset SuperSpeed USB device number 2 using xhci_hcd [2572857.209471] scsi host4: uas_eh_bus_reset_handler success [2572858.336451] sd 4:0:0:0: [sdb] tag#0 response iu 10 uas-tag 1 inflight: [2572858.336453] sd 4:0:0:0: [sdb] tag#0 CDB: Test Unit Ready 00 00 00 00 00 00 [2572858.336464] sd 4:0:0:0: Device offlined - not ready after error recovery [2572858.336468] sd 4:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_TIMEOUT [2572858.336469] sd 4:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 74 44 94 d8 00 00 28 00 [2572858.336470] blk_update_request: I/O error, dev sdb, sector 1950651608 [2572858.336524] Aborting journal on device sdb1-8. [2572858.336544] sd 4:0:0:0: rejecting I/O to offline device [2572858.336547] JBD2: Error -5 detected when updating journal superblock for sdb1-8. [2572858.336549] sd 4:0:0:0: rejecting I/O to offline device [2572858.336553] EXT4-fs error (device sdb1): ext4_journal_check_start:60: Detected aborted journal [2572858.336555] EXT4-fs (sdb1): Remounting filesystem read-only [2572858.336556] EXT4-fs (sdb1): previous I/O error to superblock detected [2572858.336557] sd 4:0:0:0: rejecting I/O to offline device [2572875.613711] xhci_hcd 0000:00:14.0: Cannot set link state. [2572875.613713] usb usb2-port1: cannot disable (err = -32) [2572875.613716] usb 2-1: USB disconnect, device number 2 [2572875.617698] sd 4:0:0:0: [sdb] Synchronizing SCSI cache [2572875.738434] sd 4:0:0:0: [sdb] Synchronize Cache(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK [2573076.115722] usb 2-1: new SuperSpeed USB device number 3 using xhci_hcd [2573076.128497] usb 2-1: New USB device found, idVendor=357d, idProduct=7788 [2573076.128498] usb 2-1: New USB device strings: Mfr=10, Product=11, SerialNumber=3 [2573076.128499] usb 2-1: Product: USB to ATA/ATAPI Bridge [2573076.128499] usb 2-1: Manufacturer: JMicron [2573076.128500] usb 2-1: SerialNumber: 000012345678 [2573076.130970] scsi host4: uas [2573076.133413] scsi 4:0:0:0: Direct-Access ST2000LM 003 HN-M201RAD 0100 PQ: 0 ANSI: 6 [2573076.152117] sd 4:0:0:0: Attached scsi generic sg2 type 0 [2573076.155777] sd 4:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB) [2573076.155778] sd 4:0:0:0: [sdb] 4096-byte physical blocks [2573076.156391] sd 4:0:0:0: [sdb] Write Protect is off [2573076.156394] sd 4:0:0:0: [sdb] Mode Sense: 67 00 10 08 [2573076.157580] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA [2573076.168725] sdb: sdb1 [2573076.174771] sd 4:0:0:0: [sdb] Attached SCSI disk [2573082.265023] EXT4-fs (sdb1): recovery complete [2573082.265173] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null) Fortunately, it seems this is a known issue and the workaround is here: https://ask.fedoraproject.org/en/question/87852/usb3-external-drive-caddy-goes-offline-after-a-while/ But I don't think asking all people to tune that in /etc is the way to go. Then, looking to other bugzillas, I found the attached patch from https://bugzilla.redhat.com/show_bug.cgi?id=1260207 that really fixes the problem for me :) But, for some reason, it seems that the patch wasn't forwarded. Before trying to open a bug in bugzilla.kernel.org I would like to see if existing https://bugzilla.kernel.org/show_bug.cgi?id=194681 is the same (to not send a duplicate). Anyway, if you are in touch with upstream to get the patch included faster... please don't hesitate to do it ;) Meantime, I would like this patch to be applied in our kernel as this jmicron chip is really common in many "cheap" brands Thanks a lot
interesting, I'm wondering about retro-compatbility. since which version have you had problem ? I think it can go in fixes if works ok, wondering why is not on upstream yet
I don't remember, I have always had this issue (I see I bought the case in August 2015, but I don't know what kernel I was running at that time... usually I run stable one or the upcoming LTS version when it goes to testing to try to ensure all works ok for that version) The oldest I have found is: http://www.spinics.net/lists/stable/msg72737.html https://patchwork.kernel.org/patch/5703231/ It seems since 3.18... this patch looks to work in my case since 4.12.x... but probably it works for older kernels too. I think that probably they tried to fix this issue two years ago, but the fix wasn't complete and wasn't really working
I suppose because the patch is for the JMS566, is no problem for other devices. adding it tomorrow :)
Thanks a lot :D
could you try the patch in 4.14 as now we are moving to stabilize 4.14 and drop 4.12 in the next weeks, after security fixes are stabilized. If you can confirm it works on the 4.14 I will add it to the next 4.14 patch queue for Gentoo-sources
as you asked in the title I can add the patch for 4.14.x but because is not a significant security fix I see not enough of a reason for pushing it to 4.12.x
It works for 4.14... and putting it on 4.14.x is enough for me. I also moved the system that was using 4.12.14 to 4.14.3 yesterday
Added From 48b873686e977cd880a698bec378d7ab2c6ca967 Mon Sep 17 00:00:00 2001 From: Alice Ferrazzi <alicef@gentoo.org> Date: Sat, 9 Dec 2017 14:07:04 +0000 Subject: [PATCH] Add UAS disable quirk. See bug #640082.
I forwarded it to the proper place to see if it's finally included by upstream :/