+10
−4
Loading
In failover test, it reports memory leak about tqpair->stats when detaching a tcp controller and it failover to the other controller. Because during resetting the controller, we disconnect the controller at first and then reconnect. when disconnecting, the adminq is not freed which means the corresponding tqpair and tqpair->stats are not freed. But when reconnecting, nvme_tcp_ctrlr_connect_qpair will allocate memory for tqpair->stats again which causes memory leak. So this patch fix the bug by not reallocating memory for tqpair->stats if it's not NULL. We keep the old stats because from user perspective, the spdk_nvme_qpair is the same one. Besides, when destroying a qpair, the qpair->poll_group is set as NULL which means if qpair->poll_group is not NULL, it should be a new qpair. So there's no need to check if stats is NULL or not if qpair->poll_group is not NULL. So adjusting the if...else... in _nvme_pcie_ctrlr_create_io_qpair. Change-Id: I4108a980aeffe4797e5bca5b1a8ea89f7457162b Signed-off-by:Richael Zhuang <richael.zhuang@arm.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17718 Tested-by:
SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by:
Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by:
Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by:
Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by:
Jim Harris <james.r.harris@intel.com>