Commit 6d87cd53 authored by Shin'ichiro Kawasaki's avatar Shin'ichiro Kawasaki Committed by Keith Busch
Browse files

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



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.

Reported-by: default avatarYi Zhang <yi.zhang@redhat.com>
Closes: https://lore.kernel.org/linux-block/CAHj4cs8mJ+R_GmQm9R8ebResKAWUE8kF5+_WVg0v8zndmqd6BQ@mail.gmail.com/
Link: https://lore.kernel.org/linux-block/oeyzci6ffshpukpfqgztsdeke5ost5hzsuz4rrsjfmvpqcevax@5nhnwbkzbrpa/


Fixes: 1f021341 ("nvme-multipath: defer partition scanning")
Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent 159de7a8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -793,7 +793,7 @@ static void nvme_mpath_set_live(struct nvme_ns *ns)
			return;
		}
		nvme_add_ns_head_cdev(head);
		kblockd_schedule_work(&head->partition_scan_work);
		queue_work(nvme_wq, &head->partition_scan_work);
	}

	nvme_mpath_add_sysfs_link(ns->head);