[PATCH] nvme-pci: serialize polling interrupt queue with shutdown

Keith Busch kbusch at kernel.org
Fri May 15 06:29:31 PDT 2026


On Fri, May 15, 2026 at 06:29:41AM +0200, Christoph Hellwig wrote:
> On Thu, May 14, 2026 at 07:45:44AM -0700, Keith Busch wrote:
> > From: Keith Busch <kbusch at kernel.org>
> > 
> > Polling an interrupt driven completion queue temporarilly disables the
> > irq. If this occurs concurrently with another thread disabling the
> > device, the irq vector may have been freed, which makes it available for
> > reuse. Reenabling the irq after polling the queue may be referencing a
> > stale irq at that point.
> > 
> > Fix this race by ensuring nvme_poll_irqdisable() can not run
> > concurrently with nvme_dev_disable(), and skip polling the completion
> > queue if the queue has already been disabled.
> 
> Do we need the same change in nvme_suspend_queue?  I.e., should the check
> and locking be moved into nvme_poll_irqdisable?

nvme_suspend_queue is called from only one place that already holds the
same lock, so not necessary. And we can't do the locking within
nvme_poll_irqdisable since nvme_dev_disable calls it with the lock
already held too. I can add lockdep asserts to make the expectations
clear, though. 



More information about the Linux-nvme mailing list