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 <james.r.harris@intel.com>
Change-Id: I2fb7b18a781caa0aadca319aa1e61a6ccf2c55fd
This commit is contained in:
Jim Harris 2017-05-03 13:28:00 -07:00 committed by Daniel Verkamp
parent a3738d9031
commit 5343c22f8d

View File

@ -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--;