Commit 8703949c authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Changpeng Liu
Browse files

lib/iscsi: Replace ISCSI_CONN_STATE_LOGGED_OUT state by is_logged_out flag



The connection state is mainly for flushing PDUs. ISCSI_CONN_STATE_LOGGED_OUT
was as same as ISCSI_CONN_STATE_RUNNING for this point.

Replace ISCSI_CONN_STATE_LOGGED_OUT state by a is_logged_out flag
and use the latter to reject any incoming PDU after sending logout
response.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3426a3ecbd241db402b1a2f7b3914a18e3591591
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470703


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 1e879636
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1258,7 +1258,7 @@ iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
 * then subsequent calls to this routine will eventually flush
 * remaining PDUs.
 *
 * During other connection states (EXITING or LOGGED_OUT), this
 * During other connection states (EXITING), this
 * function will spin until all PDUs have successfully been flushed.
 */
static int
@@ -1372,7 +1372,7 @@ iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
			return SPDK_ISCSI_CONNECTION_FATAL;
		}

		if (conn->state == ISCSI_CONN_STATE_LOGGED_OUT) {
		if (conn->is_logged_out) {
			SPDK_ERRLOG("pdu received after logout\n");
			spdk_put_pdu(pdu);
			return SPDK_ISCSI_CONNECTION_FATAL;
@@ -1499,7 +1499,7 @@ logout_timeout(void *arg)
void
spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn)
{
	conn->state = ISCSI_CONN_STATE_LOGGED_OUT;
	conn->is_logged_out = true;
	conn->logout_timer = spdk_poller_register(logout_timeout, conn, ISCSI_LOGOUT_TIMEOUT * 1000000);
}

+1 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ struct spdk_iscsi_conn {

	enum iscsi_connection_state	state;
	int				login_phase;
	bool				is_logged_out;

	uint64_t	last_flush;
	uint64_t	last_fill;
+2 −3
Original line number Diff line number Diff line
@@ -196,9 +196,8 @@ struct spdk_iscsi_pdu {
enum iscsi_connection_state {
	ISCSI_CONN_STATE_INVALID = 0,
	ISCSI_CONN_STATE_RUNNING = 1,
	ISCSI_CONN_STATE_LOGGED_OUT = 2,
	ISCSI_CONN_STATE_EXITING = 3,
	ISCSI_CONN_STATE_EXITED = 4,
	ISCSI_CONN_STATE_EXITING = 2,
	ISCSI_CONN_STATE_EXITED = 3,
};

enum iscsi_chap_phase {