public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chao Leng <lengchao@huawei.com>
To: Mike Christie <michael.christie@oracle.com>, <kbusch@kernel.org>,
	<axboe@fb.com>, <hch@lst.de>, <sagi@grimberg.me>,
	<martin.petersen@oracle.com>, <jejb@linux.ibm.com>,
	<linux-scsi@vger.kernel.org>, <linux-nvme@lists.infradead.org>,
	<linux-block@vger.kernel.org>
Subject: Re: [PATCH 3/3] nvme: Convert NVMe errors to PT_STS errors
Date: Wed, 9 Nov 2022 16:28:49 +0800	[thread overview]
Message-ID: <9df9d0cf-5583-ccfd-ffd7-54432767fdfb@huawei.com> (raw)
In-Reply-To: <20221109031106.201324-4-michael.christie@oracle.com>



On 2022/11/9 11:11, Mike Christie wrote:
> This converts the NVMe errors we could see during PR handling to PT_STS
> errors, so pr_ops callers can handle scsi and nvme errors without knowing
> the device types.
> 
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
> ---
>   drivers/nvme/host/core.c | 42 ++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 40 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index dc4220600585..8f0177045a2f 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2104,11 +2104,43 @@ static int nvme_send_ns_pr_command(struct nvme_ns *ns, struct nvme_command *c,
>   	return nvme_submit_sync_cmd(ns->queue, c, data, 16);
>   }
>   
> +static enum pr_status nvme_sc_to_pr_status(int nvme_sc)
> +{
> +	enum pr_status sts;
> +
> +	switch (nvme_sc) {
> +	case NVME_SC_SUCCESS:
> +		sts = PR_STS_SUCCESS;
> +		break;
> +	case NVME_SC_RESERVATION_CONFLICT:
> +		sts = PR_STS_RESERVATION_CONFLICT;
> +		break;
> +	case NVME_SC_HOST_PATH_ERROR:
> +		sts = PR_STS_PATH_FAILED;
All path-related errors should be considered.


  parent reply	other threads:[~2022-11-09  8:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  3:11 [PATCH 0/3] block/scsi/nvme: Add error codes for PR ops Mike Christie
2022-11-09  3:11 ` [PATCH 1/3] block: Add error codes for common PR failures Mike Christie
2022-11-09  6:52   ` Christoph Hellwig
2022-11-09  3:11 ` [PATCH 2/3] scsi: Convert SCSI errors to PR_STS errors Mike Christie
2022-11-09  6:52   ` Christoph Hellwig
2022-11-10 18:59   ` kernel test robot
2022-11-10 19:29   ` kernel test robot
2022-11-09  3:11 ` [PATCH 3/3] nvme: Convert NVMe errors to PT_STS errors Mike Christie
2022-11-09  6:53   ` Christoph Hellwig
2022-11-09 17:20     ` Mike Christie
2022-11-15  9:14       ` Christoph Hellwig
2022-11-15 16:56         ` Mike Christie
2022-11-09  8:28   ` Chao Leng [this message]
2022-11-09 17:35     ` Mike Christie
2022-11-10  0:58       ` Chao Leng

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=9df9d0cf-5583-ccfd-ffd7-54432767fdfb@huawei.com \
    --to=lengchao@huawei.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=sagi@grimberg.me \
    /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