Spdk/lib/nvme
Richael Zhuang df4600f4c9 nvme_tcp: fix memory leak when resetting controllor
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>
2023-04-27 11:00:03 +00:00
..
Makefile so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
nvme_ctrlr_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ctrlr_ocssd_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ctrlr.c include/nvme_spec.h: add changes for fdp log pages 2023-02-15 10:37:56 +00:00
nvme_cuse.c build: compile API functions with missing deps 2022-11-18 08:40:05 +00:00
nvme_cuse.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_discovery.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_fabric.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_internal.h nvme_rdma: Support SRQ for I/O qpairs 2023-01-17 23:53:01 +00:00
nvme_io_msg.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_io_msg.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ns_cmd.c lib/nvme: include dword 13 field to extendable command structure 2023-03-09 23:22:41 +00:00
nvme_ns_ocssd_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ns.c nvme: support 64 LBA formats for NVM and ZNS command set 2023-02-15 10:37:56 +00:00
nvme_opal_internal.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_opal.c misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
nvme_pcie_common.c nvme_tcp: fix memory leak when resetting controllor 2023-04-27 11:00:03 +00:00
nvme_pcie_internal.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_pcie.c lib/nvme: restore spdk_nvme_ctrlr_get_registers 2023-03-31 17:41:35 +00:00
nvme_poll_group.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_qpair.c nvme: add API to get outstanding reqs number 2023-01-09 14:49:11 +00:00
nvme_quirks.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_rdma.c lib/nvme_rdma: return negated error from nvme_rdma_parse_addr 2023-03-10 16:44:37 +00:00
nvme_tcp.c nvme_tcp: fix memory leak when resetting controllor 2023-04-27 11:00:03 +00:00
nvme_transport.c nvme_transport: return NULL if transport does not exist 2023-04-27 09:29:59 +00:00
nvme_vfio_user.c lib/nvme: restore spdk_nvme_ctrlr_get_registers 2023-03-31 17:41:35 +00:00
nvme_zns.c nvme: support 64 LBA formats for NVM and ZNS command set 2023-02-15 10:37:56 +00:00
nvme.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
spdk_nvme.map lib/nvme: restore spdk_nvme_ctrlr_get_registers 2023-03-31 17:41:35 +00:00