Commit 5343c22f authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I2fb7b18a781caa0aadca319aa1e61a6ccf2c55fd
parent a3738d90
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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--;