diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 506f13806..0b4993999 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -1503,8 +1503,7 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p spdk_trace_record(TRACE_ISCSI_FLUSH_WRITEBUF_START, conn->id, pdu->mapped_length, (uintptr_t)pdu, pdu->sock_req.iovcnt); if (spdk_unlikely((pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) || - (pdu->bhs.opcode == ISCSI_OP_LOGOUT_RSP) || - (pdu->bhs.opcode == ISCSI_OP_TEXT_RSP))) { + (pdu->bhs.opcode == ISCSI_OP_LOGOUT_RSP))) { rc = spdk_sock_writev(conn->sock, pdu->iov, pdu->sock_req.iovcnt); if (rc == pdu->mapped_length) { _iscsi_conn_pdu_write_done(pdu, 0); diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index bfe8ffd35..edd85418d 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -2279,6 +2279,32 @@ iscsi_pdu_hdr_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) return 0; } +static void +spdk_iscsi_conn_text_pdu_complete(void *arg) +{ + struct spdk_iscsi_conn *conn = arg; + int rc; + + /* update internal variables */ + rc = spdk_iscsi_copy_param2var(conn); + if (rc < 0) { + SPDK_ERRLOG("spdk_iscsi_copy_param2var() failed\n"); + if (conn->state < ISCSI_CONN_STATE_EXITING) { + conn->state = ISCSI_CONN_STATE_EXITING; + } + return; + } + + /* check value */ + rc = iscsi_check_values(conn); + if (rc < 0) { + SPDK_ERRLOG("iscsi_check_values() failed\n"); + if (conn->state < ISCSI_CONN_STATE_EXITING) { + conn->state = ISCSI_CONN_STATE_EXITING; + } + } +} + static int iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { @@ -2415,22 +2441,7 @@ iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p to_be32(&rsph->exp_cmd_sn, conn->sess->ExpCmdSN); to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN); - spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL); - - /* update internal variables */ - rc = spdk_iscsi_copy_param2var(conn); - if (rc < 0) { - SPDK_ERRLOG("spdk_iscsi_copy_param2var() failed\n"); - return -1; - } - - /* check value */ - rc = iscsi_check_values(conn); - if (rc < 0) { - SPDK_ERRLOG("iscsi_check_values() failed\n"); - return -1; - } - + spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_text_pdu_complete, conn); return 0; }