[PATCH v2 1/1] nvme: Add fault injection feature

Thomas Tai thomas.tai at oracle.com
Mon Jan 29 10:37:50 PST 2018



On 2018-01-29 01:34 PM, Sagi Grimberg wrote:
> 
>> +void nvme_should_fail(struct request *req)
>> +{
>> +    struct gendisk *disk = req->rq_disk;
>> +    struct nvme_ns *ns = NULL;
>> +
>> +    /*
>> +     * make sure this request is coming from a valid namespace
>> +     */
>> +    if (!disk)
>> +        return;
>> +
>> +    ns = disk->private_data;
>> +    if (ns && should_fail(&ns->fault_inject.attr, 1))
>> +        /* inject the error status, do not retry */
>> +        nvme_req(req)->status =    NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
> 
> I think it can be useful to control the status code (and DNR) as stuff
> like request retries and multipathing take it into account..

Hi Sagi,
Thank you for your suggestion. I will add an options in the debugfs to 
control the status code and the DNR setting.

Thanks,
Thomas




More information about the Linux-nvme mailing list