Re: Buffer I/O error after s2ram with usb storage persistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 18 Apr 2014, Matthieu CASTET wrote:

> > > 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
> > 
> > Does the same thing happen if you start the "cat" command after the 
> > suspend/resume instead of before?
> No,
> 
> "echo mem > /sys/power/state; cat /dev/sdx > /dev/null" works.

I guess this works because the initial open of /dev/sdx swallows the 
media-changed notification.

> > The device reported a "Not-ready to ready change" because the power was
> > lost and then restored.  The SCSI layer interprets this as meaning that
> > the media was changed, even though USB keys don't have changeable media
> > -- evidently your key tells the computer that it does.
> 
> yes, I tested with differents usb key and all of them report removable   
> (1
> in /sys/devices/pci0000:00/*/usb*/*/*/host*/target*/*/block/sdx/removable).

> > Since the SCSI layer thinks the media was changed, it has no choice but 
> > to fail the read request.
> ok.
> 
> I suppose the scsi layer can't ignore "Not-ready to ready change" event
> at resume time ?

But that event doesn't happen at resume time.  It happens later, when
the "cat" program issues its next read request.

In any case, the SCSI people will probably argue that ignoring such 
events would not be safe.  And if it's not safe to ignore those events 
during normal operation then it's not safe to ignore them at resume 
time.

If you want to discuss the matter any further, you should post to the 
linux-scsi mailing list.  There's not much we can do about it at the 
USB level -- although perhaps we could turn off the erroneous 
"removable" indicator.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux