diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 2c7aad110..83e50aea6 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -512,7 +512,7 @@ _spdk_iscsi_conn_check_shutdown(void *arg) _spdk_iscsi_conn_free(conn); } -static void +void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_tgt_node *target; @@ -1166,21 +1166,6 @@ spdk_iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_so } } -static int -spdk_iscsi_conn_check_state(struct spdk_iscsi_conn *conn) -{ - if (conn->state == ISCSI_CONN_STATE_EXITED) { - return -1; - } - - if (conn->state == ISCSI_CONN_STATE_EXITING) { - spdk_iscsi_conn_destruct(conn); - return -1; - } - - return 0; -} - static void spdk_iscsi_conn_full_feature_migrate(void *arg1, void *arg2) { @@ -1239,19 +1224,11 @@ spdk_iscsi_conn_migration(struct spdk_iscsi_conn *conn) void spdk_iscsi_conn_login_do_work(void *arg) { - struct spdk_iscsi_conn *conn = arg; - - /* iSCSI connection state check */ - spdk_iscsi_conn_check_state(conn); } void spdk_iscsi_conn_full_feature_do_work(void *arg) { - struct spdk_iscsi_conn *conn = arg; - - /* iSCSI connection state check */ - spdk_iscsi_conn_check_state(conn); } void diff --git a/lib/iscsi/conn.h b/lib/iscsi/conn.h index 2d6e61bef..53a7963e4 100644 --- a/lib/iscsi/conn.h +++ b/lib/iscsi/conn.h @@ -173,6 +173,7 @@ int spdk_initialize_iscsi_conns(void); void spdk_shutdown_iscsi_conns(void); int spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, struct spdk_sock *sock); +void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn); void spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn); void spdk_iscsi_conn_migration(struct spdk_iscsi_conn *conn); void spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn); diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index 65864f0ca..0a42ee7ad 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -846,7 +846,9 @@ spdk_iscsi_poll_group_poll(void *ctx) } STAILQ_FOREACH_SAFE(conn, &group->connections, link, tmp) { - conn->fn(conn); + if (conn->state == ISCSI_CONN_STATE_EXITING) { + spdk_iscsi_conn_destruct(conn); + } } }