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

Chao Leng lengchao at huawei.com
Wed Nov 9 16:58:08 PST 2022



On 2022/11/10 1:35, Mike Christie wrote:
> On 11/9/22 2:28 AM, Chao Leng wrote:
>>
>>
>> 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.
> 
> Will do. Just one question.
> 
> I didn't see NVME_SC_CTRL_PATH_ERROR and NVME_SC_INTERNAL_PATH_ERROR
> being used. Are they retryable errors?
These two types of errors depend on the implementation of the target.
All in all, the request with path-related error should fail over to retry successfully.



More information about the Linux-nvme mailing list