Skip to content

Commit 9515743

Browse files
Bijan Mottahedehkeithbusch
authored andcommitted
nvme-pci: Hold cq_poll_lock while completing CQEs
Completions need to consumed in the same order the controller submitted them, otherwise future completion entries may overwrite ones we haven't handled yet. Hold the nvme queue's poll lock while completing new CQEs to prevent another thread from freeing command tags for reuse out-of-order. Fixes: dabcefa ("nvme: provide optimized poll function for separate poll queues") Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent cae740a commit 9515743

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/nvme/host/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,9 +1078,9 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx)
10781078

10791079
spin_lock(&nvmeq->cq_poll_lock);
10801080
found = nvme_process_cq(nvmeq, &start, &end, -1);
1081+
nvme_complete_cqes(nvmeq, start, end);
10811082
spin_unlock(&nvmeq->cq_poll_lock);
10821083

1083-
nvme_complete_cqes(nvmeq, start, end);
10841084
return found;
10851085
}
10861086

0 commit comments

Comments
 (0)