On Thu, 17 Feb 2005, Sara Fonseca wrote: > On Thu, 17 Feb 2005 10:38:36 -0500 (EST), Alan Stern > <[EMAIL PROTECTED]> wrote: > > On Thu, 17 Feb 2005, Sara Fonseca wrote: > > > > > I simulated a block error doing this: when the host tries to read one > > > specific logical block, I change some bytes. The I try two things: > > > 1) Just returns the number of bytes the host expects and finish with > > > no erros. The host just reports I/O error and doesnt take any other > > > action. > > > > Do you know why the host reports an I/O error if you finish with no > > errors? How does the host realize that something went wrong? > Actually just the SCSI system detects the error(the data doesn't make sense). > Here is the error that it reports: > > usb-storage: *** thread sleeping. > SCSI error : <159 0 0 0> return code = 0x10070000 > end_request: I/O error, dev sda, sector 8 > Buffer I/O error on device sda, logical block 1
That return code means the gadget transferred fewer bytes than the host wanted. It has nothing to do with whether or not the data makes sense, and it won't occur when (as you said) the gadget returns the number of bytes the host expects. Normally when the host gets this return code it will retry the read; are you sure it didn't? > > Why should the host ignore the damaged block? I would expect the host to > > retry the read several times, eventually give up, and put an error message > > in the system log. That's very different from ignoring it. > > I performed this test by creating a fyle system in the device. When I > sad that It should ignore it, I meant that it shouldn't use it. The > host repeats the read several times indeed and then reports the > following: > > SCSI error : <158 0 0 0> return code = 0x8000002 > Info fld=0x1, Current sda: sense key Medium Error > Additional sense: Unrecovered read error > end_request: I/O error, dev sda, sector 8 > Buffer I/O error on device sda, logical block 1 > > So it knows the logical block is damaged. And it even finishes > creating the file system. But then doesn't recognize any file system > when I try to mount it. That's understandable. The filesystem probably relies on having valid data stored in block 1, and won't work without it. Alan Stern ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel