From 22bdcdc39b649daa4dc50e360ada5e9966d00757 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 22 Jan 2018 13:40:58 -0700 Subject: [PATCH] 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 Change-Id: Ie014a2e50d6ed02165317deab85c943225953197 Reviewed-on: https://review.gerrithub.io/395857 Reviewed-by: Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker --- lib/iscsi/conn.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 782fb42ab..5c6d4456d 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -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); } }