Commit 22bdcdc3 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ie014a2e50d6ed02165317deab85c943225953197

Reviewed-on: https://review.gerrithub.io/395857


Reviewed-by: default avatar <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 20528e26
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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);
	}
}