iscsi: reuse spdk_iscsi_conn_stop_poller

Similar functionality is needed when migrating a connection
to its new core after login.  So make spdk_iscsi_conn_stop_poller
reusable for that case, and call it in the login migration path.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie014a2e50d6ed02165317deab85c943225953197

Reviewed-on: https://review.gerrithub.io/395857
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2018-01-22 13:40:58 -07:00 committed by Daniel Verkamp
parent 20528e262d
commit 22bdcdc39b

View File

@ -760,7 +760,8 @@ spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_tgt_node *target;
if (conn->sess != NULL && conn->sess->session_type == SESSION_TYPE_NORMAL &&
if (conn->state == ISCSI_CONN_STATE_EXITED && conn->sess != NULL &&
conn->sess->session_type == SESSION_TYPE_NORMAL &&
conn->full_feature) {
target = conn->sess->target;
pthread_mutex_lock(&target->mutex);
@ -1391,12 +1392,10 @@ spdk_iscsi_conn_login_do_work(void *arg)
pthread_mutex_unlock(&target->mutex);
}
event = spdk_event_allocate(lcore, spdk_iscsi_conn_full_feature_migrate, conn, NULL);
spdk_iscsi_conn_stop_poller(conn);
__sync_fetch_and_sub(&g_num_connections[spdk_env_get_current_core()], 1);
__sync_fetch_and_add(&g_num_connections[lcore], 1);
spdk_net_framework_clear_socket_association(conn->sock);
spdk_poller_unregister(&conn->poller);
event = spdk_event_allocate(lcore, spdk_iscsi_conn_full_feature_migrate, conn, NULL);
spdk_event_call(event);
}
}