nvme-multipath: fix io accounting on failover
authorKeith Busch <kbusch@kernel.org>
Tue, 21 May 2024 18:02:28 +0000 (11:02 -0700)
committerKeith Busch <kbusch@kernel.org>
Thu, 23 May 2024 20:44:42 +0000 (13:44 -0700)
There are io stats accounting that needs to be handled, so don't call
blk_mq_end_request() directly. Use the existing nvme_end_req() helper
that already handles everything.

Fixes: d4d957b53d91ee ("nvme-multipath: support io stats on the mpath device")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h

index 79cdd34dfa18e663ae6a9e7fbc5d47c080cff9bd..7706df237349455769b1e6eec3e415af1dc921d5 100644 (file)
@@ -422,7 +422,7 @@ static inline void __nvme_end_req(struct request *req)
                nvme_mpath_end_request(req);
 }
 
-static inline void nvme_end_req(struct request *req)
+void nvme_end_req(struct request *req)
 {
        blk_status_t status = nvme_error_status(nvme_req(req)->status);
 
index 9c1e135b8df3b167db0397b903164315c4d444fa..1bee176fd850e35b29265ae700f1ada426e10dd5 100644 (file)
@@ -118,7 +118,8 @@ void nvme_failover_req(struct request *req)
        blk_steal_bios(&ns->head->requeue_list, req);
        spin_unlock_irqrestore(&ns->head->requeue_lock, flags);
 
-       blk_mq_end_request(req, 0);
+       nvme_req(req)->status = 0;
+       nvme_end_req(req);
        kblockd_schedule_work(&ns->head->requeue_work);
 }
 
index cacc56f4bbf4423a101e2689ad9c75c85aa2afd7..fc31bd340a63a2ff9a191d2287a46b4be8334d25 100644 (file)
@@ -767,6 +767,7 @@ static inline bool nvme_state_terminal(struct nvme_ctrl *ctrl)
        }
 }
 
+void nvme_end_req(struct request *req);
 void nvme_complete_rq(struct request *req);
 void nvme_complete_batch_req(struct request *req);