Commit 714a3bc3 authored by Sochin Jiang's avatar Sochin Jiang Committed by Tomasz Zawadzki
Browse files

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: default avatarSochin 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 0aeab1f1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -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;