Hi,

while playing with suspend to ram I found a strange behavior with usb
persistence.

This can be easily reproduce by doing :
- plug a usb key
- start to read the usb key : "cat /dev/sdx > /dev/null"
- go to suspend : "echo mem > /sys/power/state"
- while in suspend, unplug and replug the usb key (simulate usb power
loss for computer that keep power)
- exit suspend
- there is read error on the usb key


Because the power was cut during s2ram, the usb stack reset the device
<1>.
But when the user task restart, the usb storage device do not seem
ready to accept data traffic <2>, and IO error are returned to user
space application.

It look like the device need some delay after the reset (800ms between
reset and <3>). Shouldn't we wait that the device is ready before
restart IO on the device ?


Matthieu


<1>
[  117.070255] usb 2-1.4: reset high-speed USB device number 3 using ehci-pci
[...]
[  117.543922] Restarting tasks ... done.
[  117.548390] video LNXVIDEO:01: Restoring backlight state
<2>
[  117.549179] sd 6:0:0:0: [sdb] Media Changed
[  117.549184] sd 6:0:0:0: [sdb]  
[  117.549187] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  117.549189] sd 6:0:0:0: [sdb]  
[  117.549191] Sense Key : Unit Attention [current] 
[  117.549195] Info fld=0x0
[  117.549197] sd 6:0:0:0: [sdb]  
[  117.549201] Add. Sense: Not ready to ready change, medium may have changed
[  117.549203] sd 6:0:0:0: [sdb] CDB: 
[  117.549205] Read(10): 28 00 00 02 c9 00 00 00 f0 00
[  117.549212] end_request: I/O error, dev sdb, sector 182528
[  117.549218] Buffer I/O error on device sdb1, logical block 22560
[  117.549225] Buffer I/O error on device sdb1, logical block 22561
[  117.549228] Buffer I/O error on device sdb1, logical block 22562
[  117.549231] Buffer I/O error on device sdb1, logical block 22563
[  117.549233] Buffer I/O error on device sdb1, logical block 22564
[  117.549235] Buffer I/O error on device sdb1, logical block 22565
[  117.549238] Buffer I/O error on device sdb1, logical block 22566
[  117.549240] Buffer I/O error on device sdb1, logical block 22567
[  117.549243] Buffer I/O error on device sdb1, logical block 22568
[  117.549245] Buffer I/O error on device sdb1, logical block 22569
<3>
[  117.809462] sd 6:0:0:0: [sdb] No Caching mode page found
[  117.809470] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[  117.812696] sd 6:0:0:0: [sdb] No Caching mode page found
[  117.812703] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[  117.813688]  sdb: sdb1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to