public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [example PATCH - not for applying] exclude certain commands
@ 2003-04-25  0:43 Andries.Brouwer
  2003-04-25  2:12 ` Matthew Dharm
  2003-04-25 14:32 ` Alan Stern
  0 siblings, 2 replies; 11+ messages in thread
From: Andries.Brouwer @ 2003-04-25  0:43 UTC (permalink / raw)
  To: Andries.Brouwer, stelian
  Cc: James.Bottomley, afafc, greg, linux-scsi, linux-usb-devel, mike,
	pwkpete, stern

> The sd.c patch *is* needed to make it work.

Thanks for confirming.

Now that we know the facts, it is easy to answer my question

: But usb_stor_ufi_command() already contained code to
: make the length 8. How can it be that my sd.c change
: improved things?

The answer is that the length occurs twice - as part of
the SCSI command, and as bufflen. The usb-storage code
that fudges the command in the hope of producing something
more agreeable to the device forgets to adapt the bufflen.

This ends, I think, the discussion of what went wrong.
We understand perfectly - I hope.

Now about fixing the code. We must do something in usb-storage
or sd.c or both. I would prefer if sr_bufflen denotes the
actually available length, instead of the length that
will be transferred. If it has that meaning, then the
fudger in usb-storage knows for sure that there is space.
And sd_do_mode_sense6 and family can store the right number.

Are there any objections against viewing sr_bufflen
as the amount of actually available buffer space
(and thus potentially different from the transferred amount)?

Andries


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [example PATCH - not for applying] exclude certain commands
@ 2003-04-27  1:39 Matthew Dharm
  2003-04-27 14:04 ` [linux-usb-devel] " Alan Stern
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Dharm @ 2003-04-27  1:39 UTC (permalink / raw)
  To: James Bottomley; +Cc: Andries.Brouwer, greg, SCSI Mailing List, linux-usb-devel

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

On Sat, Apr 26, 2003 at 05:29:55PM -0500, James Bottomley wrote:
> This looks fine to me.  Originally, sr_bufflen was exactly that (because
> all SCSI LLDs have to be prepared to transfer fewer than the specified
> number of bytes anyway, since that's required by the spec).  I believe
> only USB needs this to be set to the actual command length (and further
> require that we ensure that the device *will* transfer exactly
> this...that's to some extent the origin of the INQUIRY problems), so the
> change should be small.

This is a common misconception.  usb-storage does not need to know, in
advance, exactly how many bytes will transfer.  It does, however, need to
know exactly how many bytes are being requested for transfer.

There's a subtle difference there.  usb-storage can handle the case of
underrun or overrun properly.  But there are USB<->[SCSI|ATA|whatever]
bridges which can't handle a discrepancy between expected transfer length
and actual transfer length when no error was detected.

I can give examples, but it's confusing and not really relevant unless
someone wants to know.

There are also broken devices which are specifically broken with respect to
the INQUIRY command for length != 36, but that's a separate issue to a
certain degree.  These are really two separate problems.

Matt

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

YOU SEE!!?? It's like being born with only one nipple!
					-- Erwin
User Friendly, 10/19/1998

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [example PATCH - not for applying] exclude certain commands
@ 2003-04-24 20:20 James Bottomley
  2003-04-24 21:09 ` [linux-usb-devel] " Alan Stern
  0 siblings, 1 reply; 11+ messages in thread
From: James Bottomley @ 2003-04-24 20:20 UTC (permalink / raw)
  To: Matthew Dharm
  Cc: Andries.Brouwer, afafc, Alan Cox, greg, SCSI Mailing List,
	linux-usb-devel, mike, stelian, torvalds

On Thu, 2003-04-24 at 15:14, Matthew Dharm wrote:
> Well, at this point, I guess I should just be happy that something is being
> done.  But, what I'm really afraid of, this coming right back to this
> point.
> 
> In the past, I modified the write-protect probing in 2.4.x to be more compatible
> with what usb-storage wanted.  But then someone changed it, and it broke.
> So we changed it again... and it was fine for a while.  Then someone
> changed it in 2.5.x, and it broke again.
> 
> I guess what's got me frustrated is that this is very fragile, tends to
> cause serious problems when it fails, often gets changed, and isn't really
> necessary -- after all, that's why the 'assume write-enabled' code path is
> there for when the request fails.
> 
> I've just been around and around this merry-go-round, and I'm trying to get
> off.  We can fix it now, but I am truly afraid that it's going to get
> broken again in 6 months.

To some extent, I'm afraid you can't get off:  you're stuck on here with
the rest of us.

I can't guarantee that changes to the SCSI subsystem won't break USB
devices.  However, what I can guarantee is that we'll work to fix the
problems as they arise.

> And, as for the need for filtering, I know we have such a need.  I have
> several devices on my desk which choke at INQUIRY EVPD -- so right now I
> filter it in the usb-storage driver.  I also have devices that report bogus
> INQUIRY data lengths, but (luckily) the sanity checks in the INQUIRY
> probing code generally catch those cases and save us.

I think the evpd code can be thrown out into user land (where the rules
governing how it's used can be much more flexible).  All we really use
it for is to get a unique name.  However, even WWN inquiries don't
always guarantee even that...

> I've seen devices that choke on START_STOP, unless that START_STOP is an
> eject command.  I fixed this by eliminating the only non-eject use of
> START_STOP in sd.c -- but how long is it before someone decides they need
> to use START_STOP for something?

sd.c uses START_STOP to spin up an inactive disc (but only if we get a
check condition/NOT READY). sr_ioctl.c uses it to eject or close a cd
tray.

> We may have fixed MODE_SENSE, but what about the other cases?

I think we just have to identify them and tackle them in the same way.

Do you have any other current bug reports you'd like to share with us?

James



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-04-27 13:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-25  0:43 [example PATCH - not for applying] exclude certain commands Andries.Brouwer
2003-04-25  2:12 ` Matthew Dharm
2003-04-25  4:34   ` [linux-usb-devel] " Matthew Dharm
2003-04-25  8:11     ` Mike Bursell
2003-04-25 14:32 ` Alan Stern
2003-04-25 15:12   ` Oliver Neukum
2003-04-26  0:58     ` Alan Stern
2003-04-26  8:24       ` Oliver Neukum
2003-04-26 15:22         ` Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2003-04-27  1:39 Matthew Dharm
2003-04-27 14:04 ` [linux-usb-devel] " Alan Stern
2003-04-24 20:20 James Bottomley
2003-04-24 21:09 ` [linux-usb-devel] " Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox