Re: PATCH; make sr.c respect use_10_for_ms

Matthew Dharm
2003-06-22T00:16:30Z

[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]

On Sat, Jun 21, 2003 at 05:21:53PM -0700, Linus Torvalds wrote:
> On Sat, 21 Jun 2003, Matthew Dharm wrote:
> > I mean, this works, it's not difficult to follow, and meets all the
> > operational goals.
>
> As far as I can tell, your patch is not actually all that stable.
>
> Imagine a flaky SCSI connection (think iscsi or whatever), where your
> commands are getting lost or corrupted. The first mode-sense command goes
> out, it takes a while to come back, another one goes out for some other
> reason (like scsi-generic), that other one failes due to something else,
> and look what happens: two bugs in one schenario:
>
> - your code will clear "use_10_for_ms" even though the failure code
> wasn't due to an unrecognized command, but due to something else
> (timeout, out-of-memory, whatever)

True. With this scenario and the old code, the code just makes an
assumption and goes on -- I did not aim to improve robustness, only
maintain it. You can make the same argument about the existing code
falling back to the dumb-assumption condition under a transient error
condition.

So if this is a problem, then this entire section of code needed a rewrite
before I ever looked at it. Until that rewrite occurs, I think my patch
adds value.

> - when the other sense command comes back, it was sent with
> "use_10_for_ms" active, but by the time the result comes back it has
> been cleared, and now we'll use that flag to test what the sense data
> means. So now we'll get the size wrong.

I don't see how a sense command sent from the scsi-generic interface will
affect (or be affected by) use_10_for_ms -- if scsi-generic issues the
command, this code path won't try to interpret the data at all. Perhaps
I'm confused?

Matt

--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver

C: Like the Furby?
DP: He gives me the creeps. Think the SPCA will take him?
-- Cobb and Dust Puppy
User Friendly, 1/2/1999