Exemple #1
0
static void
nvmf_test_disconnect(void)
{
	uint64_t fabric_conn_admin = 1;
	uint64_t fabric_conn_IO = 2;
	struct nvmf_session *sess;
	struct spdk_nvmf_subsystem *subsystem;

	sess = nvmf_find_session_by_id("subsystem1", SS_SC_CNTLID);
	/* delete non-exist connection */
	nvmf_disconnect((void *)6, sess);
	/* we have two connections admin and io */
	CU_ASSERT_EQUAL(sess->num_connections, 2);
	/* delete IO connection */
	nvmf_disconnect((void *)fabric_conn_IO, sess);
	CU_ASSERT_EQUAL(sess->num_connections, 1);
	/* delete admin connection */
	nvmf_disconnect((void *)fabric_conn_admin, sess);
	subsystem = nvmf_find_subsystem("subsystem1");
	CU_ASSERT_EQUAL(subsystem->num_sessions, 0);
}
Exemple #2
0
static void
_conn_destruct(spdk_event_t event)
{
	struct spdk_nvmf_conn *conn = spdk_event_get_arg1(event);

	/*
	 * Notify NVMf library of the fabric connection
	 * going away.  If this is the AQ connection then
	 * set state for other connections to abort.
	 */
	nvmf_disconnect((void *)conn, conn->sess);

	if (conn->type == CONN_TYPE_AQ) {
		SPDK_TRACELOG(SPDK_TRACE_DEBUG, "AQ connection destruct, trigger session closure\n");
		/* Trigger all I/O connections to shutdown */
		conn->state = CONN_STATE_FABRIC_DISCONNECT;
	}

	nvmf_rdma_conn_cleanup(conn);

	pthread_mutex_lock(&g_conns_mutex);
	free_conn(conn);
	pthread_mutex_unlock(&g_conns_mutex);
}