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 <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent cae740a commit 9515743

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)