[PATCH 3/3] nvme: Convert NVMe errors to PT_STS errors

Chao Leng lengchao at huawei.com
Wed Nov 9 00:28:49 PST 2022



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 at 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.



More information about the Linux-nvme mailing list