nvme-pci: split the initial probe from the rest path
authorChristoph Hellwig <hch@lst.de>
Sun, 13 Nov 2022 11:07:04 +0000 (12:07 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 16 Nov 2022 07:36:33 +0000 (08:36 +0100)
commiteac3ef262941f62fe01bc357911fea4847183333
tree8971699d60e14db79aee1f3243e6c72d9e00ae70
parentacb71e53bb47a08731aa77497cd3f1871cba59c3
nvme-pci: split the initial probe from the rest path

nvme_reset_work is a little fragile as it needs to handle both resetting
a live controller and initializing one during probe.  Split out the initial
probe and open code it in nvme_probe and leave nvme_reset_work to just do
the live controller reset.

This fixes a recently introduced bug where nvme_dev_disable causes a NULL
pointer dereferences in blk_mq_quiesce_tagset because the tagset pointer
is not set when the reset state is entered directly from the new state.
The separate probe code can skip the reset state and probe directly and
fixes this.

To make sure the system isn't single threaded on enabling nvme
controllers, set the PROBE_PREFER_ASYNCHRONOUS flag in the device_driver
structure so that the driver core probes in parallel.

Fixes: 98d81f0df70c ("nvme: use blk_mq_[un]quiesce_tagset")
Reported-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Tested-by Gerd Bayer <gbayer@linxu.ibm.com>
drivers/nvme/host/pci.c