iscsi: Fix conflict by destructing connection and logout timeout

During destructing a connection, if timeout of logout timer for the
connection occurs, spdk_iscsi_conn_destruct() will be called again
to the connection.

Segmentation fault by multiple calls of spdk_iscsi_conn_destruct()
have been observed when exiting one of the sesssions during IO tests
for multiple sessions.

     Fix #574

Change-Id: I69873905486953bfb0cdb43b000b8e38ff9346ac
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/440466
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-01-15 16:46:05 +09:00 committed by Changpeng Liu
parent 1875912ff0
commit 47d5ddb7ce

View File

@ -559,6 +559,11 @@ _spdk_iscsi_conn_check_pending_tasks(void *arg)
void
spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
{
/* If a connection is already in exited status, just return */
if (conn->state >= ISCSI_CONN_STATE_EXITED) {
return;
}
conn->state = ISCSI_CONN_STATE_EXITED;
if (conn->sess != NULL && conn->pending_task_cnt > 0) {