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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3426a3ecbd241db402b1a2f7b3914a18e3591591
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470703
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-10-08 07:55:20 +09:00 committed by Changpeng Liu
parent 1e879636a2
commit 8703949c05
3 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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 {