linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Jason Yan <yanaijie@huawei.com>
Cc: <axboe@kernel.dk>, <ming.lei@redhat.com>, <hch@lst.de>,
	<keescook@chromium.org>, <kbusch@kernel.org>,
	<linux-block@vger.kernel.org>, <martin.petersen@oracle.com>,
	<jejb@linux.vnet.ibm.com>, <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 1/3] scsi: check the whole result for reading write protect flag
Date: Wed, 24 Mar 2021 22:50:07 -0400	[thread overview]
Message-ID: <yq1a6qskl3j.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <20210319030128.1345061-2-yanaijie@huawei.com> (Jason Yan's message of "Fri, 19 Mar 2021 11:01:26 +0800")


Hi Jason!

> @@ -55,6 +55,19 @@ static inline int scsi_status_is_good(int status)
>  		(status == SAM_STAT_COMMAND_TERMINATED));
>  }
>  
> +/** scsi_result_is_good - check the result return.
> + *
> + * @result: the result passed up from the driver (including host and
> + *          driver components)
> + *
> + * Drivers may only set other bytes but not status byte.
> + * This checks both the status byte and other bytes.
> + */
> +static inline int scsi_result_is_good(int result)
> +{
> +	return scsi_status_is_good(result) && (result & ~0xff) == 0;
> +}
> +
>  
>  /*
>   * standard mode-select header prepended to all mode-select commands

Instead of introducing a "don't be broken" variant of
scsi_status_is_good(), I'd prefer you to fix the latter to do the right
thing wrt. offline devices.

There aren't a ton of scsi_result_is_good() call sites to check. And I
suspect that most of them wouldn't actually consider the DID_NO_CONNECT
scenario to be "good".

-- 
Martin K. Petersen	Oracle Linux Engineering

  parent reply	other threads:[~2021-03-25  2:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19  3:01 [PATCH 0/3] scsi: check the whole result in some places Jason Yan
2021-03-19  3:01 ` [PATCH 1/3] scsi: check the whole result for reading write protect flag Jason Yan
2021-03-19  7:55   ` Hannes Reinecke
2021-03-25  2:50   ` Martin K. Petersen [this message]
2021-03-27  6:57     ` Jason Yan
2021-03-19  3:01 ` [PATCH 2/3] scsi: only copy data to user when the whole result is good Jason Yan
2021-03-19  7:56   ` Hannes Reinecke
2021-03-19  8:22     ` Jason Yan
2021-03-19  3:01 ` [PATCH 3/3] scsi: switch to use scsi_result_is_good() in scsi_result_to_blk_status() Jason Yan
2021-03-19  7:56   ` Hannes Reinecke

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=yq1a6qskl3j.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kbusch@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@redhat.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;
as well as URLs for NNTP newsgroup(s).