From 5343c22f8db1df80185ef71f530773e847aee5f0 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 3 May 2017 13:28:00 -0700 Subject: [PATCH] iscsi: do not free io channel refs if login failed When destroying a connection, we need to check if we got to full feature phase before freeing any io channels. This is because the io channels are only allocated as part of a successful login. The Calsoft iSCSI test suite has tests which will fail login. Since the test system was just using a malloc backend with memcpy, so even though a channel was NULL in some cases, it was never used since the memcpy engine doesn't need it. This prepares for some future patches which extend the use of io channels in the bdev layer. Signed-off-by: Jim Harris Change-Id: I2fb7b18a781caa0aadca319aa1e61a6ccf2c55fd --- lib/iscsi/conn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 67424662f..06d485cce 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -702,7 +702,8 @@ spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn, spdk_event_fn fn_after struct spdk_event *event; struct spdk_iscsi_tgt_node *target; - if (conn->sess != NULL && conn->sess->session_type == SESSION_TYPE_NORMAL) { + if (conn->sess != NULL && conn->sess->session_type == SESSION_TYPE_NORMAL && + conn->full_feature) { target = conn->sess->target; pthread_mutex_lock(&target->mutex); target->num_active_conns--;