All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: Lan Tran <transter@gmail.com>, Jens Axboe <axboe@suse.de>
Cc: linux-scsi@vger.kernel.org, johntsai@us.ibm.com, tranlan@us.ibm.com
Subject: Re: BUG: SCSI INQUIRY thru SCSI_IOCTL_SEND_COMMAND returns no errno for disconnected device
Date: Fri, 1 Oct 2004 09:31:31 -0700	[thread overview]
Message-ID: <20041001163131.GA23156@beaverton.ibm.com> (raw)
In-Reply-To: <ac71172a04093012437c353f83@mail.gmail.com>

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

  reply	other threads:[~2004-10-01 16:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2004-10-08 23:43   ` Lan Tran
2004-10-09  6:35     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041001163131.GA23156@beaverton.ibm.com \
    --to=patmans@us.ibm.com \
    --cc=axboe@suse.de \
    --cc=johntsai@us.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tranlan@us.ibm.com \
    --cc=transter@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.