[PATCH] nvme-pci: Fix multiple races in nvme_setup_io_queues()
Keith Busch
kbusch at kernel.org
Wed Jun 16 09:20:56 PDT 2021
On Tue, Jun 15, 2021 at 02:57:41PM -0700, Casey Chen wrote:
> @@ -1590,8 +1590,9 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid, bool polled)
> goto release_cq;
>
> nvmeq->cq_vector = vector;
> - nvme_init_queue(nvmeq, qid);
>
> + mutex_lock(&dev->shutdown_lock);
I really think you want to use mutex_trylock() here and return early if
locking fails since that must mean the device is being disabled.
Waiting to acquire the lock in this path doesn't do any good on a
disabled device.
More information about the Linux-nvme
mailing list