diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-05-28 08:48:12 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-05-28 08:48:12 -0600 |
commit | 15fede122b23e126baeba69558a14c68e5d9359f (patch) | |
tree | 47e7efdacb622aec03de75b3e787418a45d13f78 /drivers | |
parent | 1592cd15eec6e2952453f9a82da6e8a53e2b8db5 (diff) | |
parent | 9210c075cef29c1f764b4252f93105103bdfb292 (diff) |
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()
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/nvme/host/pci.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 3726dc780d15..cc46e250fcac 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1382,16 +1382,19 @@ static void nvme_disable_admin_queue(struct nvme_dev *dev, bool shutdown) /* * Called only on a device that has been disabled and after all other threads - * that can check this device's completion queues have synced. This is the - * last chance for the driver to see a natural completion before - * nvme_cancel_request() terminates all incomplete requests. + * that can check this device's completion queues have synced, except + * nvme_poll(). This is the last chance for the driver to see a natural + * completion before nvme_cancel_request() terminates all incomplete requests. */ static void nvme_reap_pending_cqes(struct nvme_dev *dev) { int i; - for (i = dev->ctrl.queue_count - 1; i > 0; i--) + for (i = dev->ctrl.queue_count - 1; i > 0; i--) { + spin_lock(&dev->queues[i].cq_poll_lock); nvme_process_cq(&dev->queues[i]); + spin_unlock(&dev->queues[i].cq_poll_lock); + } } static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues, |