diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2019-06-09 16:17:01 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-06-21 11:15:50 +0200 |
commit | f79d5fda4ea08c33a114087573d86f703149ee0e (patch) | |
tree | 486ed1a351edbbc6e771560b9ca11544fa65b8cc /drivers/nvme/host/fault_inject.c | |
parent | nvme: prepare for fault injection into admin commands (diff) | |
download | linux-f79d5fda4ea08c33a114087573d86f703149ee0e.tar.xz linux-f79d5fda4ea08c33a114087573d86f703149ee0e.zip |
nvme: enable to inject errors into admin commands
This enables to inject errors into the commands submitted to the admin
queue.
It is useful to test error handling in the controller initialization.
# echo 100 > /sys/kernel/debug/nvme0/fault_inject/probability
# echo 1 > /sys/kernel/debug/nvme0/fault_inject/times
# echo 10 > /sys/kernel/debug/nvme0/fault_inject/space
# nvme reset /dev/nvme0
# dmesg
...
nvme nvme0: Could not set queue count (16385)
nvme nvme0: IO queues not created
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme/host/fault_inject.c')
-rw-r--r-- | drivers/nvme/host/fault_inject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvme/host/fault_inject.c b/drivers/nvme/host/fault_inject.c index e37b8c2fddea..1352159733b0 100644 --- a/drivers/nvme/host/fault_inject.c +++ b/drivers/nvme/host/fault_inject.c @@ -60,9 +60,6 @@ void nvme_should_fail(struct request *req) struct nvme_fault_inject *fault_inject = NULL; u16 status; - /* - * make sure this request is coming from a valid namespace - */ if (disk) { struct nvme_ns *ns = disk->private_data; @@ -70,6 +67,8 @@ void nvme_should_fail(struct request *req) fault_inject = &ns->fault_inject; else WARN_ONCE(1, "No namespace found for request\n"); + } else { + fault_inject = &nvme_req(req)->ctrl->fault_inject; } if (fault_inject && should_fail(&fault_inject->attr, 1)) { |