Commit df06c0d2 authored by Changpeng Liu's avatar Changpeng Liu Committed by Daniel Verkamp
Browse files

iscsi: drop the connection when quit the process



We cannot quit the process when user did not Logout from the session,
because the active connections always bigger than zero. User cannot
use Ctrl+C to quit SPDK iSCSI target. Add a new state to connection
to avoid destruct connection more than once.

Change-Id: I8efa79aa47534bd6ead965713769f751d9802e47
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 6db4f2b0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -592,7 +592,7 @@ void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
	struct spdk_iscsi_tgt_node	*target;
	int				rc;

	conn->state = ISCSI_CONN_STATE_EXITING;
	conn->state = ISCSI_CONN_STATE_EXITED;

	if (conn->sess != NULL && conn->pending_task_cnt > 0) {
		target = conn->sess->target;
@@ -1239,9 +1239,13 @@ spdk_iscsi_conn_execute(struct spdk_iscsi_conn *conn)
	uint64_t			tsc;
	bool				conn_active = false;

	if (conn->state == ISCSI_CONN_STATE_EXITING) {
	if (conn->state == ISCSI_CONN_STATE_EXITED) {
		return -1;
	}

	if (conn->state == ISCSI_CONN_STATE_EXITING) {
		goto conn_exit;
	}
	/* Check for nop interval expiration */
	rc = spdk_iscsi_conn_handle_nop(conn);
	if (rc < 0) {
+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ enum iscsi_connection_state {
	ISCSI_CONN_STATE_RUNNING = 1,
	ISCSI_CONN_STATE_LOGGED_OUT = 2,
	ISCSI_CONN_STATE_EXITING = 3,
	ISCSI_CONN_STATE_EXITED = 4,
};

enum iscsi_chap_phase {