[PATCH] nvme-multipath: fix lockdep WARN due to partition scan work

Keith Busch kbusch at kernel.org
Thu Oct 23 07:28:03 PDT 2025


On Wed, Oct 22, 2025 at 10:54:54PM -0700, Christoph Hellwig wrote:
> On Thu, Oct 23, 2025 at 09:19:37AM +0900, Shin'ichiro Kawasaki wrote:
> > Blktests test cases nvme/014, 057 and 058 fail occasionally due to a
> > lockdep WARN. As reported in the Closes tag URL, the WARN indicates that
> > a deadlock can happen due to the dependency among disk->open_mutex,
> > kblockd workqueue completion and partition_scan_work completion.
> > 
> > To avoid the lockdep WARN and the potential deadlock, cut the dependency
> > by running the partition_scan_work not by kblockd workqueue but by
> > nvme_wq.
> 
> The partition_scan_work was added in 1f021341eef4 ("nvme-multipath:
> defer partition scanning") to get it out of the scan work to avoid
> deadlocks.  I suspect moving it to the same workqueue might reintroduce
> the deadlocks, so we might have to add a new workqueue here.  Keith
> might remember more.

I don't think it was a problem of the same workqueue, but because
partition scanning happened in the same work_struct as namespace
scanning. As long as the two happen in different work items, I believe
they can use the same workqueue and be fine.



More information about the Linux-nvme mailing list