[RFC 0/1] nvme: Add NVMe LBA Fault Injection
Keith Busch
kbusch at kernel.org
Thu Jan 18 20:48:03 PST 2024
On Thu, Jan 18, 2024 at 09:02:43AM -0800, alan.adamson at oracle.com wrote:
>
> On 1/17/24 11:24 PM, Christoph Hellwig wrote:
> > On Tue, Jan 16, 2024 at 03:27:27PM -0800, Alan Adamson wrote:
> > > It has been requested that the NVMe fault injector be able to inject faults when accessing
> > > specific Logical Block Addresses (LBA).
> > Curious, but who has requested this? Because injecting errors really
> > isn't the drivers job.
>
>
> It's an application (database) that is requesting it for their error
> handling testing.
Going out on a limb here... This seems so obscure to burden a driver to
synthesize. Could we just give a hook for a bpf override and you can
totally go for whatever scenario you can imagine with a script?
---
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 50818dbcfa1ae..df87a63335aa8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -381,9 +381,22 @@ static inline void nvme_end_req_zoned(struct request *req)
}
}
+#ifdef CONFIG_BPF_KPROBE_OVERRIDE
+static noinline blk_status_t nvme_req_status(struct nvme_request *req)
+{
+ return nvme_error_status(req->status);
+}
+ALLOW_ERROR_INJECTION(nvme_req_status, ERRNO);
+#else
+static inline blk_status_t nvme_req_status(struct nvme_request *req)
+{
+ return nvme_error_status(req->status);
+}
+#endif
+
static inline void nvme_end_req(struct request *req)
{
- blk_status_t status = nvme_error_status(nvme_req(req)->status);
+ blk_status_t status = nvme_req_status(nvme_req(req));
if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET)))
nvme_log_error(req);
--
More information about the Linux-nvme
mailing list