Skip to content

Commit bb642e2

Browse files
amitbchaudharykeithbusch
authored andcommitted
nvme-multipath: Skip nr_active increments in RETRY disposition
For queue-depth I/O policy, this patch fixes unbalanced I/Os across nvme multipaths. Issue Description: The RETRY disposition incorrectly increments ns->ctrl->nr_active counter and reinitializes iostat start-time. In such cases nr_active counter never goes back to zero until that path disconnects and reconnects. Such a path is not chosen for new I/Os if multiple RETRY cases on a given a path cause its queue-depth counter to be artificially higher compared to other paths. This leads to unbalanced I/Os across paths. The patch skips incrementing nr_active if NVME_MPATH_CNT_ACTIVE is already set. And it skips restarting io stats if NVME_MPATH_IO_STATS is already set. base-commit: e989a3d Fixes: d4d957b ("nvme-multipath: support io stats on the mpath device") Signed-off-by: Amit Chaudhary <achaudhary@purestorage.com> Reviewed-by: Randy Jennings <randyj@purestorage.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 455281c commit bb642e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/nvme/host/multipath.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,14 @@ void nvme_mpath_start_request(struct request *rq)
182182
struct nvme_ns *ns = rq->q->queuedata;
183183
struct gendisk *disk = ns->head->disk;
184184

185-
if (READ_ONCE(ns->head->subsys->iopolicy) == NVME_IOPOLICY_QD) {
185+
if ((READ_ONCE(ns->head->subsys->iopolicy) == NVME_IOPOLICY_QD) &&
186+
!(nvme_req(rq)->flags & NVME_MPATH_CNT_ACTIVE)) {
186187
atomic_inc(&ns->ctrl->nr_active);
187188
nvme_req(rq)->flags |= NVME_MPATH_CNT_ACTIVE;
188189
}
189190

190-
if (!blk_queue_io_stat(disk->queue) || blk_rq_is_passthrough(rq))
191+
if (!blk_queue_io_stat(disk->queue) || blk_rq_is_passthrough(rq) ||
192+
(nvme_req(rq)->flags & NVME_MPATH_IO_STATS))
191193
return;
192194

193195
nvme_req(rq)->flags |= NVME_MPATH_IO_STATS;

0 commit comments

Comments
 (0)