diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index dbf5c6bdc..5ad238c85 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -592,7 +592,7 @@ void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) struct spdk_iscsi_tgt_node *target; int rc; - conn->state = ISCSI_CONN_STATE_EXITING; + conn->state = ISCSI_CONN_STATE_EXITED; if (conn->sess != NULL && conn->pending_task_cnt > 0) { target = conn->sess->target; @@ -1239,9 +1239,13 @@ spdk_iscsi_conn_execute(struct spdk_iscsi_conn *conn) uint64_t tsc; bool conn_active = false; - if (conn->state == ISCSI_CONN_STATE_EXITING) { + if (conn->state == ISCSI_CONN_STATE_EXITED) { return -1; } + + if (conn->state == ISCSI_CONN_STATE_EXITING) { + goto conn_exit; + } /* Check for nop interval expiration */ rc = spdk_iscsi_conn_handle_nop(conn); if (rc < 0) { diff --git a/lib/iscsi/iscsi.h b/lib/iscsi/iscsi.h index b6d0716c4..45ebb81c6 100644 --- a/lib/iscsi/iscsi.h +++ b/lib/iscsi/iscsi.h @@ -195,6 +195,7 @@ enum iscsi_connection_state { ISCSI_CONN_STATE_RUNNING = 1, ISCSI_CONN_STATE_LOGGED_OUT = 2, ISCSI_CONN_STATE_EXITING = 3, + ISCSI_CONN_STATE_EXITED = 4, }; enum iscsi_chap_phase {