From 3cfb1fe8dd1bcf223a2407344c76cfbbaa8aa7f5 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Mon, 10 Jun 2019 09:46:15 +0900 Subject: [PATCH] iscsi: Schedule the connection only after completing login processing Previously the connection was scheduled to another core just after setting conn->full_feature to 1, but conn->state was still ISCSI_CONN_STATE_INVALID. The connection started to run on another core but could not run normally until conn->state became ISCSI_CONN_STATE_RUNNING. conn->state was changed late to ISCSI_CONN_STATE_RUNNING after sending the first login reponse. This gap window had caused intermittent critical failures. Based on this analysis, this patch changes to call spdk_iscsi_conn_schedule() just after sending the final login response. Whether any login response is final or not can be known by checking conn->full_feature is not zero. Fixes #785 Signed-off-by: Shuhei Matsumoto Change-Id: I8ea55fef27e2f332fcd789d32daf479a24c0588d Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457414 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Ziye Yang Reviewed-by: Changpeng Liu --- lib/iscsi/iscsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 1f6207b56..f1421d543 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -2129,7 +2129,6 @@ iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn, } conn->full_feature = 1; - spdk_iscsi_conn_schedule(conn); break; default: @@ -2241,6 +2240,9 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) rc = iscsi_op_login_response(conn, rsp_pdu, *params_p); if (rc == 0) { conn->state = ISCSI_CONN_STATE_RUNNING; + if (conn->full_feature != 0) { + spdk_iscsi_conn_schedule(conn); + } } else { SPDK_ERRLOG("login error - connection will be destroyed\n"); }