Re: Linux megaraid 1.05 driver patch for doing pass-through ioctl's

Douglas Gilbert (dgilbert@interlog.com)
Sat, 04 Dec 1999 12:08:16 -0500


ard wrote:
> Hi,
> While trying to do some pass through commands using the megaraid 466 card,
> I got some bizarre error conditions.
> The problem was that the megaraid driver just returned the status without
> massageing it into linux-friendly values.
> Resulting of course in scsi_obsolete errors and requeueing the command.
> This patch fixes this by ALWAYS returning DID_BAD_DRIVE on any status
> condition for ioctl's on the megaraid host-adapter.
> This patch will not influence normal behavior, but it might however have
> influence on the megamgr program (which I am not using anyway), that does
> do ioctl's on the host-adapter.

There are 2 ways that I can think of that you did this "pass through":
- using the SCSI_IOCTL_SEND_COMMAND ioctl()
- using the scsi generic (sg) device.

Given the problem that you are reporting my guess is that you
used the first one. There are 2 problems with that, retries
are attempted (that in the worst case can lead to SCSI bus resets)
and that ioctl either gives your data back (in the case of a read
like command) or a sense buffer (in the case of any non-zero
status/error).

The sg device instructs the mid-level not to attempt retries
(which the mid-level ignores in the case of DID_SOFT_ERROR ??)
and if the SCSI command requested returned data then something
will be returned as well as SCSI status/error codes. [The
"something returned" can be useful data in the case of
CHECK CONDITION, RECOVERED ERROR.]

Even though the SCSI_IOCTL_SEND_COMMAND ioctl() is deprecated
it is still supported. Recently I wrote some documentation for
it that appears in front of the
scsi_ioctl::scsi_ioctl_send_command() function definition in
the lk 2.3 tree. It is also discussed in
http://www.torque.net/sg/p/scsi-generic_long.txt .

The megaraid driver obviously should clean up its internal
scsi return value.

Doug Gilbert
P.S. Sorry about this cross post, the original post should have
gone to the linux-scsi group.

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