From: James Bottomley <jejb@linux.ibm.com>
To: Wenchao Hao <haowenchao22@gmail.com>
Cc: Wenchao Hao <haowenchao@huawei.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Mike Christie <michael.christie@oracle.com>,
linux-scsi@vger.kernel.org, linfeilong@huawei.com,
yanaijie@huawei.com, xuhujie@huawei.com, lijinlin3@huawei.com
Subject: Re: [QUESTION]: Why did we clear the lowest bit of SCSI command's status in scsi_status_is_good
Date: Mon, 28 Nov 2022 13:12:39 -0500 [thread overview]
Message-ID: <f2e3c4dc0bfad6b05f40d716738e56f2cbb80810.camel@linux.ibm.com> (raw)
In-Reply-To: <CAOptpSPfswNrmYe4rnKFM3zWXY7P0JuWY94p=mfp7tV9ghFQ2w@mail.gmail.com>
On Tue, 2022-11-29 at 01:38 +0800, Wenchao Hao wrote:
> On Mon, Nov 28, 2022 at 11:24 PM James Bottomley <jejb@linux.ibm.com>
> wrote:
> >
> > On Mon, 2022-11-28 at 22:41 +0800, Wenchao Hao wrote:
> > > On 2022/11/28 20:52, James Bottomley wrote:
> > > > On Mon, 2022-11-28 at 11:58 +0800, Wenchao Hao wrote:
> > [...]
> > > > > We found some firmware or drivers would return status which
> > > > > did not defined in SAM. Now SCSI middle level do not have an
> > > > > uniform behavior for these undefined status. I want to change
> > > > > the logic to return error for all status which did not
> > > > > defined in SAM or define a method in host template to let
> > > > > drivers to judge what to do in this condition.
> > > >
> > > > Why? The general rule of thumb is be strict in what you emit
> > > > and generous in what you receive (which is why reserved bits
> > > > are ignored). Is the drive you refer to above not working in
> > > > some way, in which case detail it so people can understand the
> > > > actual problem.
> > > >
> > > > James
> > > >
> > > > .
> > >
> > >
> > > We come with an issue with megaraid_sas driver. Where scsi_cmnd
> > > is completed with result's status byte set to 1,
> >
> > Megaraid_sas is an emulation driver for the most part, so it sounds
> > like this is in the RAID emulation firmware, correct? The driver
> > can correct for emulation failures, if you can figure out what it's
> > trying to signal and convert it to the correct SAM error code.
> > There's no need to change anything in the layers above. If you
> > can't figure out the translation and you want the transfer to
> > error, then add DID_ERROR, which is a nice catch all. If this is
> > transient and could be fixed by a retry, then do DID_SOFT_ERROR
> > instead.
> >
> > James
> >
>
> Thanks for your answer, Of curse we can recognize these undefined
> status and map to an error which can be handled by SCSI middle level
> now. But I still confused why shouldn't we change the
> scsi_status_is_good() to respect to SAM?
Because it wouldn't be backwards compatible and something might break.
Under SCSI-1, devices were allowed to set this bit to signal vendor
unique status and a lot of manufacturers continued doing this for SCSI-
2, even though it was flagged as reserved instead of vendor specific in
that standard, hence the mask. Since this was over 20 years ago, it is
possible there is no remaining functional device that does this, but if
it's not causing a problem, why take the risk?
James
next prev parent reply other threads:[~2022-11-28 18:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 3:58 [QUESTION]: Why did we clear the lowest bit of SCSI command's status in scsi_status_is_good Wenchao Hao
2022-11-28 12:52 ` James Bottomley
2022-11-28 14:41 ` Wenchao Hao
2022-11-28 15:21 ` James Bottomley
2022-11-28 17:38 ` Wenchao Hao
2022-11-28 18:12 ` James Bottomley [this message]
2022-12-02 13:58 ` Wenchao Hao
2022-12-02 14:17 ` James Bottomley
2022-12-02 16:26 ` Wenchao Hao
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=f2e3c4dc0bfad6b05f40d716738e56f2cbb80810.camel@linux.ibm.com \
--to=jejb@linux.ibm.com \
--cc=haowenchao22@gmail.com \
--cc=haowenchao@huawei.com \
--cc=lijinlin3@huawei.com \
--cc=linfeilong@huawei.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=xuhujie@huawei.com \
--cc=yanaijie@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox