nvme_pcie: re-probe the pci bus on hotplug event

Explicitly attaching a PCI device with spdk_pci_device_attach()
bypasses any kind of blacklists and should be only used
on a user request. Hotplug uevent is certainly not a user
request and should respect the blacklist, hence it's now
changed to call spdk_pci_enumerate() to probe new devices.
The enumeration callback will reject devices other that the
one we got hotplug request for, so no behavior is changed
in that matter.

This patch also fixes undefined behavior caused by reading
unitialized struct nvme_pcie_enum_cb;

Change-Id: I1399fbdd426152a13ed75c85a52bc7f0491ce287
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/433867
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Darek Stojaczyk 2018-11-19 13:41:08 +01:00 committed by Jim Harris
parent 63bafd40a7
commit 8ee5ca50e7

View File

@ -766,8 +766,10 @@ nvme_pcie_ctrlr_attach(spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pc
enum_ctx.probe_cb = probe_cb;
enum_ctx.cb_ctx = cb_ctx;
enum_ctx.has_pci_addr = true;
enum_ctx.pci_addr = *pci_addr;
return spdk_pci_nvme_device_attach(pcie_nvme_enum_cb, &enum_ctx, pci_addr);
return spdk_pci_nvme_enumerate(pcie_nvme_enum_cb, &enum_ctx);
}
struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transport_id *trid,