lib/iscsi: unregister login timeout timer in right place

In commit 9eefbc, we've fixed an iscsi connection leak problem(
use telnet ${ip} ${port} to reproduce), that a connection without
login handshake will be left forever with 'invalid' state. Here,
to avoid killing normal connections by mistake, we need to unregister
login timeout timer in two right places:
1) immediately after login timeout happened
2) when we receive login pdu instead of login success(login may fail
because all kinds of reasons: ACL...)

Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I55bbc1c6ac6d2e0b6545b9f7d802ba057b2a09dc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5209
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Sochin Jiang 2020-11-24 16:36:45 +08:00 committed by Tomasz Zawadzki
parent 0aeab1f13d
commit 714a3bc3da
2 changed files with 2 additions and 1 deletions

View File

@ -178,6 +178,7 @@ login_timeout(void *arg)
if (conn->state < ISCSI_CONN_STATE_EXITING) {
conn->state = ISCSI_CONN_STATE_EXITING;
}
spdk_poller_unregister(&conn->login_timer);
return SPDK_POLLER_BUSY;
}

View File

@ -1148,7 +1148,6 @@ iscsi_conn_login_pdu_success_complete(void *arg)
{
struct spdk_iscsi_conn *conn = arg;
spdk_poller_unregister(&conn->login_timer);
if (conn->state >= ISCSI_CONN_STATE_EXITING) {
/* Connection is being exited before this callback is executed. */
@ -2226,6 +2225,7 @@ iscsi_pdu_payload_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *
return 0;
}
spdk_poller_unregister(&conn->login_timer);
rsp_pdu = conn->login_rsp_pdu;
reqh = (struct iscsi_bhs_login_req *)&pdu->bhs;