Bug 175379

Summary: [umass] usb card-reader problem with writing
Product: Base System Reporter: Yury <yury>
Component: usbAssignee: freebsd-usb (Nobody) <usb>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: 9.1-RELEASE   
Hardware: Any   
OS: Any   

Description Yury 2013-01-17 18:00:00 UTC
After connecting USB card-reader with microSD card loaded, the red led
light turns on. Then I mount that drive. In dmesg I see:

umass0: <Generic Mass Storage Device, class 0/0, rev 2.00/1.00, addr 2> on usbus2
umass0:8:0:-1: Attached to scbus8
(probe0:umass-sim0:0:0:0): Down reving Protocol Version from 2 to 0?
sg2 at umass-sim0 bus 0 scbus8 target 0 lun 0
sg2: <Multi Flash Reader 1.00> Removable Direct Access SCSI-0 device 
sg2: Serial Number 058F0O1111B1
sg2: 40.000MB/s transfers
pass5 at umass-sim0 bus 0 scbus8 target 0 lun 0
pass5: <Multi Flash Reader 1.00> Removable Direct Access SCSI-0 device 
pass5: Serial Number 058F0O1111B1
pass5: 40.000MB/s transfers
GEOM: new disk da0
da0 at umass-sim0 bus 0 scbus8 target 0 lun 0
da0: <Multi Flash Reader 1.00> Removable Direct Access SCSI-0 device 
da0: Serial Number 058F0O1111B1
da0: 40.000MB/s transfers
da0: 15279MB (31291392 512 byte sectors: 255H 63S/T 1947C)

Files are read O.K. from SD card through that USB-cardreader. But when
I try to write some files on SD card, I get luck in much less than half
times. Small files (about tens of kB) are written O.K. But when I write
larger ones, the device turnes led light off, and becomes irresponsible.
Only "usbconfig reset" helps. But filesystem is wrecked and needs "fsck".
Dmesg output is as follows^

(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 0 0 1 e2 c0 0 0 80 0 
(da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(da0:umass-sim0:0:0:0): Retrying command
(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 0 0 1 e2 c0 0 0 80 0 
(da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(da0:umass-sim0:0:0:0): Retrying command
(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 0 0 1 e2 c0 0 0 80 0 
(da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(da0:umass-sim0:0:0:0): Retrying command
(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 0 0 1 e2 c0 0 0 80 0 
(da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(da0:umass-sim0:0:0:0): Retrying command
(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 0 0 1 e2 c0 0 0 80 0 
(da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(da0:umass-sim0:0:0:0): Error 5, Retries exhausted
g_vfs_done():da0s1[WRITE(offset=59146240, length=65536)]error = 5
g_vfs_done():da0s1[WRITE(offset=59211776, length=65536)]error = 5
g_vfs_done():da0s1[WRITE(offset=59277312, length=65536)]error = 5
g_vfs_done():da0s1[WRITE(offset=59342848, length=65536)]error = 5
...

I have AMD-powered usb controller on motherboard:

kernel: ehci1: <AMD SB7x0/SB8x0/SB9x0 USB 2.0 controller> mem 0xfe5fa800-0xfe5fa8ff irq 19 at device 19.2 on pci0
kernel: ehci1: AMD SB600/700 quirk applied
kernel: ohci4: <AMD SB7x0/SB8x0/SB9x0 USB controller> mem 0xfe5f9000-0xfe5f9fff irq 18 at device 20.5 on pci0

Yes, on Windows there's no such problem as far as I tried.

How-To-Repeat: Use mentioned above hardware and try usage scenario.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:07 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped