nvme: don't monitor hotplug events in secondary process
NVMe hotplug must be monitored in the primary process - DPDK doesn't support trying to handle it in the secondary process. This issue was somewhat masked previously in secondary processes, since usually it would just probe(NULL) which meant probe all attached NVMe controllers. So in the secondary process, we would probe just once, and create the hotplug fd - it would never actually try to monitor it. But when explicitly specifying multiple trids in a secondary process, probe would get called multiple times. First time would be fine since it only creates the hotplug fd. But second time would segfault since monitoring for hotplug requires checking the DPDK-allocated context which doesn't exist in the secondary process. Fixes issue #1063. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I2a9a91e222c206034293d90e30e3f598c8d7baa8 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475015 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
27e88b8d91
commit
c3aaaa0181
@ -766,13 +766,16 @@ nvme_pcie_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
|
||||
enum_ctx.has_pci_addr = true;
|
||||
}
|
||||
|
||||
if (g_hotplug_fd < 0) {
|
||||
g_hotplug_fd = spdk_uevent_connect();
|
||||
/* Only the primary process can monitor hotplug. */
|
||||
if (spdk_process_is_primary()) {
|
||||
if (g_hotplug_fd < 0) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_NVME, "Failed to open uevent netlink socket\n");
|
||||
g_hotplug_fd = spdk_uevent_connect();
|
||||
if (g_hotplug_fd < 0) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_NVME, "Failed to open uevent netlink socket\n");
|
||||
}
|
||||
} else {
|
||||
_nvme_pcie_hotplug_monitor(probe_ctx);
|
||||
}
|
||||
} else {
|
||||
_nvme_pcie_hotplug_monitor(probe_ctx);
|
||||
}
|
||||
|
||||
if (enum_ctx.has_pci_addr == false) {
|
||||
|
Loading…
Reference in New Issue
Block a user