nvme: fix pci device leak when detaching a controller in primary process

This case isn't particularly supported, but still
caused a memory leak and rendered the pci device
inaccessible for the rest of the primary process
lifetime.

This happens when a controller is removed from the
primary process while a secondary process still
uses it. The controller will likely misbehave without
its primary process managing it, but at least there
won't be a leak.

Change-Id: I67581cffa33ce14ff516b5743d13c9ef7b351625
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/434408 (master)
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448366
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-11-22 17:25:29 +01:00
parent 9bdd0195fe
commit 156ae159a8

View File

@ -1650,7 +1650,7 @@ nvme_ctrlr_remove_process(struct spdk_nvme_ctrlr *ctrlr,
TAILQ_REMOVE(&ctrlr->active_procs, proc, tailq);
if (!proc->is_primary && ctrlr->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) {
if (ctrlr->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) {
spdk_pci_device_detach(proc->devhandle);
}