Skip to content

Commit 15fede1

Browse files
committed
Merge branch 'nvme-5.7' of git://git.infradead.org/nvme into block-5.7
Pull NVMe poll fix from Christoph. * 'nvme-5.7' of git://git.infradead.org/nvme: nvme-pci: avoid race between nvme_reap_pending_cqes() and nvme_poll()
2 parents 1592cd1 + 9210c07 commit 15fede1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/nvme/host/pci.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,16 +1382,19 @@ static void nvme_disable_admin_queue(struct nvme_dev *dev, bool shutdown)
13821382

13831383
/*
13841384
* Called only on a device that has been disabled and after all other threads
1385-
* that can check this device's completion queues have synced. This is the
1386-
* last chance for the driver to see a natural completion before
1387-
* nvme_cancel_request() terminates all incomplete requests.
1385+
* that can check this device's completion queues have synced, except
1386+
* nvme_poll(). This is the last chance for the driver to see a natural
1387+
* completion before nvme_cancel_request() terminates all incomplete requests.
13881388
*/
13891389
static void nvme_reap_pending_cqes(struct nvme_dev *dev)
13901390
{
13911391
int i;
13921392

1393-
for (i = dev->ctrl.queue_count - 1; i > 0; i--)
1393+
for (i = dev->ctrl.queue_count - 1; i > 0; i--) {
1394+
spin_lock(&dev->queues[i].cq_poll_lock);
13941395
nvme_process_cq(&dev->queues[i]);
1396+
spin_unlock(&dev->queues[i].cq_poll_lock);
1397+
}
13951398
}
13961399

13971400
static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,

0 commit comments

Comments
 (0)