Commit 1d3e0340 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

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: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/434408


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 5557c59c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1686,7 +1686,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);
	}