* BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device
@ 2004-09-30 19:43 Lan Tran
2004-10-01 16:31 ` Patrick Mansfield
0 siblings, 1 reply; 4+ messages in thread
From: Lan Tran @ 2004-09-30 19:43 UTC (permalink / raw)
To: linux-scsi; +Cc: johntsai, tranlan
We have a SAN system set up, where our host is connected to IBM ESS
storage and SVC storage. When we disconnect ALL FC cables between the
host and storage devices, and then send a SCSI INQUIRY using the
SCSI_IOCTL_SEND_COMMAND ioctl to the
sd devices, the ioctl does not return with a failure code. Instead, it
returns with a zero-length buffer.
Is there a reason why we would get a zeroed-length buffer instead of
an error return code?
We see this problem on both an emulex driver (2.10f) and qlogic driver
(8.00.00b14, non failover version).
Looking through the kernel SCSI layer code, it just seems that the
SCSI inquiry is packaged up as a request and sent off to the LLDD. So
is something strange happening in the LLDD's ...
Thanks!!
Lan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device
2004-09-30 19:43 BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device Lan Tran
@ 2004-10-01 16:31 ` Patrick Mansfield
2004-10-08 23:43 ` Lan Tran
0 siblings, 1 reply; 4+ messages in thread
From: Patrick Mansfield @ 2004-10-01 16:31 UTC (permalink / raw)
To: Lan Tran, Jens Axboe; +Cc: linux-scsi, johntsai, tranlan
On Thu, Sep 30, 2004 at 12:43:47PM -0700, Lan Tran wrote:
> We have a SAN system set up, where our host is connected to IBM ESS
> storage and SVC storage. When we disconnect ALL FC cables between the
> host and storage devices, and then send a SCSI INQUIRY using the
> SCSI_IOCTL_SEND_COMMAND ioctl to the
> sd devices, the ioctl does not return with a failure code. Instead, it
> returns with a zero-length buffer.
>
> Is there a reason why we would get a zeroed-length buffer instead of
> an error return code?
SCSI_IOCTL_SEND_COMMAND is deprecated, you should be using SG_IO instead.
There was a bug with SG_IO, it does not correctly set all of the status
bytes, a patch has been submitted a few times, Mike C's patch
fixed problems compared to ones I posted earlier, this patch:
http://marc.theaimsgroup.com/?l=linux-scsi&m=108617935710955&w=2
It looks like SCSI_IOCTL_SEND_COMMAND has a similiar issue, in that it
only checks the low byte of the results, so for example a DID_NO_CONNECT
returned by the qlogic or emulex driver would be ignored.
See drivers/block/scsi_ioctl.c near the end of sg_scsi_ioctl, this:
err = rq->errors & 0xff; /* only 8 bit SCSI status */
Compare that to code in drivers/scsi/scsi_ioctl.c near the end of
scsi_ioctl_send_command, where the entire result is checked, not just the
SCSI byte.
-- Patrick Mansfield
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device
2004-10-01 16:31 ` Patrick Mansfield
@ 2004-10-08 23:43 ` Lan Tran
2004-10-09 6:35 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Lan Tran @ 2004-10-08 23:43 UTC (permalink / raw)
To: Patrick Mansfield; +Cc: Jens Axboe, linux-scsi, johntsai, tranlan
Thanks Patrick for the tip! After trying out SG_IO, it works, as long
as we use Mike C's patch.
Lan
On Fri, 1 Oct 2004 09:31:31 -0700, Patrick Mansfield <patmans@us.ibm.com> wrote:
> On Thu, Sep 30, 2004 at 12:43:47PM -0700, Lan Tran wrote:
> > We have a SAN system set up, where our host is connected to IBM ESS
> > storage and SVC storage. When we disconnect ALL FC cables between the
> > host and storage devices, and then send a SCSI INQUIRY using the
> > SCSI_IOCTL_SEND_COMMAND ioctl to the
> > sd devices, the ioctl does not return with a failure code. Instead, it
> > returns with a zero-length buffer.
> >
> > Is there a reason why we would get a zeroed-length buffer instead of
> > an error return code?
>
> SCSI_IOCTL_SEND_COMMAND is deprecated, you should be using SG_IO instead.
>
> There was a bug with SG_IO, it does not correctly set all of the status
> bytes, a patch has been submitted a few times, Mike C's patch
> fixed problems compared to ones I posted earlier, this patch:
>
> http://marc.theaimsgroup.com/?l=linux-scsi&m=108617935710955&w=2
>
> It looks like SCSI_IOCTL_SEND_COMMAND has a similiar issue, in that it
> only checks the low byte of the results, so for example a DID_NO_CONNECT
> returned by the qlogic or emulex driver would be ignored.
>
> See drivers/block/scsi_ioctl.c near the end of sg_scsi_ioctl, this:
>
> err = rq->errors & 0xff; /* only 8 bit SCSI status */
>
> Compare that to code in drivers/scsi/scsi_ioctl.c near the end of
> scsi_ioctl_send_command, where the entire result is checked, not just the
> SCSI byte.
>
> -- Patrick Mansfield
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device
2004-10-08 23:43 ` Lan Tran
@ 2004-10-09 6:35 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2004-10-09 6:35 UTC (permalink / raw)
To: Lan Tran; +Cc: Patrick Mansfield, linux-scsi, johntsai, tranlan
On Fri, Oct 08 2004, Lan Tran wrote:
> Thanks Patrick for the tip! After trying out SG_IO, it works, as long
> as we use Mike C's patch.
>
> Lan
>
> On Fri, 1 Oct 2004 09:31:31 -0700, Patrick Mansfield <patmans@us.ibm.com> wrote:
> > On Thu, Sep 30, 2004 at 12:43:47PM -0700, Lan Tran wrote:
> > > We have a SAN system set up, where our host is connected to IBM ESS
> > > storage and SVC storage. When we disconnect ALL FC cables between the
> > > host and storage devices, and then send a SCSI INQUIRY using the
> > > SCSI_IOCTL_SEND_COMMAND ioctl to the
> > > sd devices, the ioctl does not return with a failure code. Instead, it
> > > returns with a zero-length buffer.
> > >
> > > Is there a reason why we would get a zeroed-length buffer instead of
> > > an error return code?
> >
> > SCSI_IOCTL_SEND_COMMAND is deprecated, you should be using SG_IO instead.
> >
> > There was a bug with SG_IO, it does not correctly set all of the status
> > bytes, a patch has been submitted a few times, Mike C's patch
> > fixed problems compared to ones I posted earlier, this patch:
> >
> > http://marc.theaimsgroup.com/?l=linux-scsi&m=108617935710955&w=2
> >
> > It looks like SCSI_IOCTL_SEND_COMMAND has a similiar issue, in that it
> > only checks the low byte of the results, so for example a DID_NO_CONNECT
> > returned by the qlogic or emulex driver would be ignored.
> >
> > See drivers/block/scsi_ioctl.c near the end of sg_scsi_ioctl, this:
> >
> > err = rq->errors & 0xff; /* only 8 bit SCSI status */
> >
> > Compare that to code in drivers/scsi/scsi_ioctl.c near the end of
> > scsi_ioctl_send_command, where the entire result is checked, not just the
> > SCSI byte.
I'll make sure to get that patch finally in. It made it to the bsg tree,
and never further. Thanks for the reminder.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-10-09 6:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-30 19:43 BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device Lan Tran
2004-10-01 16:31 ` Patrick Mansfield
2004-10-08 23:43 ` Lan Tran
2004-10-09 6:35 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).