Re: USB serial regression 2.6.31.1 -> 2.6.31.2

From: Benjamin Herrenschmidt
Date: Sat Oct 10 2009 - 19:49:42 EST


On Sun, 2009-10-11 at 10:26 +1100, Benjamin Herrenschmidt wrote:
> On Sat, 2009-10-10 at 18:52 -0400, Alan Stern wrote:
> > > Maybe a better approach would be to go back to 18 bytes when it fails,
> > > what do you think ?
> >
> > We certainly could do that. But should we turn off the SANE_SENSE flag
> > at the same time?
>
> I would think so, and not set it back the next time the sense buffer
> claims more data in it (something like setting a NOT_REALLY_SANE_SENSE
> flag ? :-)
>
> Or not care and always do double sense on those devices. Whatever
> works. It's not that sense was a fast path.

Ok, so here's an absolutely horrible hack that makes it work here,
but of course, I think that should be done more cleanly.

With some printk added I verified that it does ping pong
US_FL_SANE_SENSE (ie, sets it back as soon as the command
succeeds) but I don't see that as a big deal though.

I doubt you want to apply that as-is though but in case you do:

Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

Cheers,
Ben.

--- a/drivers/usb/storage/transport.c 2009-10-09 14:34:14.638445171 +1100
+++ b/drivers/usb/storage/transport.c 2009-10-11 10:40:55.890868361 +1100
@@ -687,6 +687,7 @@
US_DEBUGP("-- unexpectedly short transfer\n");
}

+ Retry_Sense:
/* Now, if we need to do the auto-sense, let's do it */
if (need_auto_sense) {
int temp_result;
@@ -722,6 +723,11 @@
}
if (temp_result != USB_STOR_TRANSPORT_GOOD) {
US_DEBUGP("-- auto-sense failure\n");
+ if (us->fflags & US_FL_SANE_SENSE) {
+ us->fflags &= ~US_FL_SANE_SENSE;
+ US_DEBUGP("-- retry without SANE_SENSE\n");
+ goto Retry_Sense;
+ }

/* we skip the reset if this happens to be a
* multi-target device, since failure of an


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