lib/iscsi: Using async writev for ISCSI_OP_TEXT_RSP PDU
To avoid partial write issue of this PDU. Signed-off-by: Ziye Yang <ziye.yang@intel.com> Change-Id: Id9b22da844c75ae53c6881850d192b40ac4098ac Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481948 Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
e199f1a5b4
commit
b03612bf4d
@ -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,
|
spdk_trace_record(TRACE_ISCSI_FLUSH_WRITEBUF_START, conn->id, pdu->mapped_length, (uintptr_t)pdu,
|
||||||
pdu->sock_req.iovcnt);
|
pdu->sock_req.iovcnt);
|
||||||
if (spdk_unlikely((pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) ||
|
if (spdk_unlikely((pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) ||
|
||||||
(pdu->bhs.opcode == ISCSI_OP_LOGOUT_RSP) ||
|
(pdu->bhs.opcode == ISCSI_OP_LOGOUT_RSP))) {
|
||||||
(pdu->bhs.opcode == ISCSI_OP_TEXT_RSP))) {
|
|
||||||
rc = spdk_sock_writev(conn->sock, pdu->iov, pdu->sock_req.iovcnt);
|
rc = spdk_sock_writev(conn->sock, pdu->iov, pdu->sock_req.iovcnt);
|
||||||
if (rc == pdu->mapped_length) {
|
if (rc == pdu->mapped_length) {
|
||||||
_iscsi_conn_pdu_write_done(pdu, 0);
|
_iscsi_conn_pdu_write_done(pdu, 0);
|
||||||
|
@ -2279,6 +2279,32 @@ iscsi_pdu_hdr_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
return 0;
|
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
|
static int
|
||||||
iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
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->exp_cmd_sn, conn->sess->ExpCmdSN);
|
||||||
to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN);
|
to_be32(&rsph->max_cmd_sn, conn->sess->MaxCmdSN);
|
||||||
|
|
||||||
spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL);
|
spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_text_pdu_complete, conn);
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user