Spdk/lib
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
..
accel accel: add method for getting per-channel opcode stats 2023-04-26 11:15:40 +00:00
bdev accel: make spdk_accel_sequence_finish() void 2023-04-19 06:36:20 +00:00
blob blob: esnap clones are not clones 2023-04-26 17:32:13 +00:00
blobfs so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
conf so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
dma so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
env_dpdk env_dpdk: optimizing spdk_call_unaffinitized 2023-04-27 09:38:49 +00:00
env_ocf lib/env_ocf: place allocator variable on hugepages 2023-04-21 23:49:28 +00:00
event app: use --lcores to map ids greater than 128 2023-04-10 17:58:20 +00:00
ftl so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
idxd lib/idxd: Removed SPDK_IDXD_FLAG_PERSISTENT flag 2023-03-03 11:20:03 +00:00
init init: rewrite subsystem_sort 2023-04-13 04:58:05 +00:00
ioat so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
iscsi iscsi: Return if conn->sock is NULL when updating connection params 2023-04-06 21:30:38 +00:00
json so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
jsonrpc freebsd: return negated error from getaddrinfo() 2023-03-10 16:44:37 +00:00
log so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
lvol vbdev_lvol: load esnaps via examine_config 2023-04-26 17:32:13 +00:00
mlx5 so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
nbd so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
notify so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
nvme nvme_tcp: fix memory leak when resetting controllor 2023-04-27 11:00:03 +00:00
nvmf nvmf: initialize trid param in get_***_trid paths 2023-04-27 09:24:18 +00:00
rdma so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
reduce libreduce: removing deprecation messages for pmem 2023-04-17 09:36:07 +00:00
rocksdb rocksdb: remove spdk_thread 2022-11-23 08:22:04 +00:00
rpc so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
scsi so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
sock sock: Allow flushing even if the socket is in a poll group 2023-01-24 18:18:33 +00:00
thread thread: Move get/put calls into .c file 2023-04-06 20:16:49 +00:00
trace so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
trace_parser so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
ublk lib/ublk: use page aligned data buffer 2023-03-28 10:20:50 +00:00
ut_mock so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
util util/pipe: Simplify some null checks 2023-04-06 20:20:19 +00:00
vfio_user so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
vfu_tgt so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
vhost vhost_blk: make sure to_blk_dev() return value is not NULL 2023-04-27 09:30:42 +00:00
virtio lib/virtio_vfio_user: use VIRTIO_PCI_VRING_ALIGN aligned vring address 2023-02-09 11:31:39 +00:00
vmd so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
Makefile ublk: add configure and event/subsystem 2023-01-20 07:48:25 +00:00