[PATCH v2 1/1] nvme: Add fault injection feature
Sagi Grimberg
sagi at grimberg.me
Mon Jan 29 10:34:26 PST 2018
> +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..
More information about the Linux-nvme
mailing list