Bug 1289012

Summary: usb reset causes data corruption bug
Product: [Fedora] Fedora Reporter: Giovanni Campagna <scampa.giovanni>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: andreas_barth, gansalmon, itamar, jonathan, kernel-maint, labbott, madhu.chinakonda, mchehab, scampa.giovanni
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-18 14:35:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Giovanni Campagna 2015-12-07 08:52:54 UTC
Description of problem:
I have a MacBook Pro from 2015, which has a SD card reader attached off a USB3 internal port.

Unfortunately, it seems this is not playing well with the usb subsystem in the kernel: every few seconds the device resets, which interrupts and truncates the block ongoing operation, which in turns causes e2fsck and the ext4 fs to report spurious block errors or even corrupt the filesystem.

I see this in the logs:

Dec 07 00:39:48 giovanni-macbook kernel: usb 2-4: Disable of device-initiated U1 failed.
Dec 07 00:39:53 giovanni-macbook kernel: usb 2-4: Disable of device-initiated U2 failed.
Dec 07 00:39:54 giovanni-macbook kernel: usb 2-4: reset SuperSpeed USB device number 3 using xhci_hcd
Dec 07 00:39:54 giovanni-macbook kernel: sd 2:0:0:0: [sdb] FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Dec 07 00:39:54 giovanni-macbook kernel: sd 2:0:0:0: [sdb] CDB: Read(10) 28 00 00 02 00 10 00 00 08 00
Dec 07 00:39:54 giovanni-macbook kernel: blk_update_request: I/O error, dev sdb, sector 131088

Repeated every about 30s for random blocks. Every usb reset is followed by a sd failure and a IO error, which causes e2fsck to prompt

Version-Release number of selected component (if applicable):
4.2.6-301.fc23.x86_64

How reproducible:
Always, with this SD card.

Steps to Reproduce:
1. Insert SD card
2. Watch USB errors in the logs
3. Cry for corrupted filesystem from bogus attempts to replay the journal

Comment 1 Giovanni Campagna 2016-04-11 18:11:05 UTC
For the record, this has gotten worse with kernel 4.4.6-301.fc23.x86_64, now it resets before the userspace has even a chance to see the device (but right after corrupting the fs, just in case).

Comment 2 Laura Abbott 2016-09-23 19:24:39 UTC
*********** MASS BUG UPDATE **************
 
We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 23 kernel bugs.
 
Fedora 23 has now been rebased to 4.7.4-100.fc23.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.
 
If you have moved on to Fedora 24 or 25, and are still experiencing this issue, please change the version to Fedora 24 or 25.
 
If you experience different issues, please open a new bug report for those.

Comment 3 Giovanni Campagna 2016-10-18 04:34:39 UTC
I have moved to Fedora 25 meanwhile, and I cannot verify if this is fixed on recent kernels, because the kernel no longer sees the card reader at all.

Comment 4 Laura Abbott 2016-10-18 14:35:07 UTC
Thank you for letting us know. I am going to close the bug. If you see the problem again, please reopen.

Comment 5 Andreas B. 2018-07-21 16:10:27 UTC
I also have a MacBook pro, late 2014. Recently I wanted to use a SD-Card in the internal Card Reader. Unfortunately, this caused problems highly similar to what is reported here. The card sporadically resets because of some self-initiated power down and then there are read/write errors also corrupting the file system. From dmesg:

usb 2-4: Disable of device-initiated U1 failed.
usb 2-4: Disable of device-initiated U2 failed.
usb 2-4: reset SuperSpeed USB device number 2 using xhci_hcd
sd 1:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
sd 1:0:0:0: [sdb] tag#0 Sense Key : Unit Attention [current] 
sd 1:0:0:0: [sdb] tag#0 Add. Sense: Not ready to ready change, medium may have changed
sd 1:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 1d cf f3 f0 00 00 08 00

I am on kernel version 4.17.8-1-ARCH. So please excuse, if this is a foreign Linux distro for you. But as the problem seems a general Linux issue, and this was already reported here, I wonder if still something can be done about it. If I can help to debug this, let me know.