From f76cf58294ed5c703524be2c8265a66994ada777 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 30 Mar 2020 15:37:20 -0700 Subject: [PATCH] bdev/iscsi: Release request after connection is done This request was getting leaked previously. Change-Id: I6e7dc24c92d7bae7a8df54025d61eb391a569df9 Signed-off-by: Ben Walker Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1591 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- module/bdev/iscsi/bdev_iscsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/bdev/iscsi/bdev_iscsi.c b/module/bdev/iscsi/bdev_iscsi.c index 3b6ad82cac..69544990f2 100644 --- a/module/bdev/iscsi/bdev_iscsi.c +++ b/module/bdev/iscsi/bdev_iscsi.c @@ -144,7 +144,6 @@ _iscsi_free_lun(void *arg) static void _bdev_iscsi_conn_req_free(struct bdev_iscsi_conn_req *req) { - free(req->initiator_iqn); free(req->bdev_name); free(req->url); @@ -771,7 +770,12 @@ iscsi_bdev_conn_poll(void *arg) } } - if (req->status != SCSI_STATUS_GOOD) { + if (req->status == 0) { + /* + * The request completed successfully. + */ + free(req); + } else if (req->status > 0) { /* * An error has occurred during connecting. This req has already * been removed from the g_iscsi_conn_req list, but we needed to @@ -838,6 +842,7 @@ create_iscsi_disk(const char *bdev_name, const char *url, const char *initiator_ } iscsi_destroy_url(iscsi_url); + req->status = -1; TAILQ_INSERT_TAIL(&g_iscsi_conn_req, req, link); if (!g_conn_poller) { g_conn_poller = spdk_poller_register(iscsi_bdev_conn_poll, NULL, BDEV_ISCSI_CONNECTION_POLL_US);