[PATCH] nvme-core: optimize process for error status NVME_SC_CMD_INTERRUPTED

Chao Leng lengchao at huawei.com
Sat Jul 25 05:00:44 EDT 2020


On 2020/7/25 6:01, Sagi Grimberg wrote:
>
>> @@ -243,7 +242,7 @@ static blk_status_t nvme_error_status(u16 status)
>>     static inline bool nvme_req_needs_retry(struct request *req)
>>   {
>> -    if (blk_noretry_request(req))
>> +    if (!nvme_req_local_retry(req) && blk_noretry_request(req))
>
> Why is this needed?

Because if work with dm-multipath or other multipath software,
the multipath software will set cmd_flags as REQ_FAILFAST_TRANSPORT.
If io return with any error, nvme will return io error to block layer,
the multipath will set the path fault and retry in other path,
but realy need retry in the current path in some scenarios.
So we need introduce nvme_req_local_retry to check if need retry
in the current path, if needed, do not need checking the cmd_flags
through blk_noretry_request. According the protocol define,
the error code NVME_SC_CMD_INTERRUPTED is a good choice.

The scenario which need retry in the current path:
Scenario 1: user configures a QoS policy on the storage system.
Storage system need to tell host to retry io after a defined time
when need control QoS. Host should retry the io in the current path
instead of return io to block layer.

Scenario 3:many hosts(more than 100) access the same storage device.
I/Os are not delivered at the same time in most cases,however a large
number of I/Os may be burst delivered at the same time sometimes.
In this case, the storage device can not treat all I/Os, needs host
retry in the current path after a defined time.

Scenario 3: storage software upgrade inline. The storage system may need
host retry in the current path after software upgrade completed.


>
>>           return false;
>>       if (nvme_req(req)->status & NVME_SC_DNR)
>>           return false;
>> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
>> index 1de3f9b827aa..3213aae8985c 100644
>> --- a/drivers/nvme/host/nvme.h
>> +++ b/drivers/nvme/host/nvme.h
>> @@ -725,4 +725,10 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl);
>>   static inline void nvme_hwmon_init(struct nvme_ctrl *ctrl) { }
>>   #endif
>>   +static inline bool nvme_req_local_retry(struct request *req)
>> +{
>> +    if (nvme_req(req)->status == NVME_SC_CMD_INTERRUPTED)
>> +        return true;
>> +    return false;
>> +}
>>   #endif /* _NVME_H */
>>



More information about the Linux-nvme mailing list