lib/iscsi: Using async writev for ISCSI_OP_LOGOUT_RSP PDU
Change-Id: I9d6d547645930c5075dca7d1e8c566634cda8e73 Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482028 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.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
16d5a6155a
commit
74ce72edca
@ -1502,17 +1502,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_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);
|
||||
} else {
|
||||
SPDK_ERRLOG("Login RSP or Logout RSP could not write to socket.\n");
|
||||
_iscsi_conn_pdu_write_done(pdu, -1);
|
||||
}
|
||||
} else {
|
||||
spdk_sock_writev_async(conn->sock, &pdu->sock_req);
|
||||
}
|
||||
spdk_sock_writev_async(conn->sock, &pdu->sock_req);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2449,6 +2449,46 @@ iscsi_pdu_payload_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void iscsi_conn_logout_pdu_complete(void *arg)
|
||||
{
|
||||
struct spdk_iscsi_conn *conn = arg;
|
||||
|
||||
if (conn->sess == NULL) {
|
||||
/*
|
||||
* login failed but initiator still sent a logout rather than
|
||||
* just closing the TCP connection.
|
||||
*/
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Logout(login failed) from %s (%s) on"
|
||||
" (%s:%s,%d)\n",
|
||||
conn->initiator_name, conn->initiator_addr,
|
||||
conn->portal_host, conn->portal_port, conn->pg_tag);
|
||||
} else if (spdk_iscsi_param_eq_val(conn->sess->params, "SessionType", "Normal")) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Logout from %s (%s) on %s tgt_node%d"
|
||||
" (%s:%s,%d), ISID=%"PRIx64", TSIH=%u,"
|
||||
" CID=%u, HeaderDigest=%s, DataDigest=%s\n",
|
||||
conn->initiator_name, conn->initiator_addr,
|
||||
conn->target->name, conn->target->num,
|
||||
conn->portal_host, conn->portal_port, conn->pg_tag,
|
||||
conn->sess->isid, conn->sess->tsih, conn->cid,
|
||||
(spdk_iscsi_param_eq_val(conn->params, "HeaderDigest", "CRC32C")
|
||||
? "on" : "off"),
|
||||
(spdk_iscsi_param_eq_val(conn->params, "DataDigest", "CRC32C")
|
||||
? "on" : "off"));
|
||||
} else {
|
||||
/* discovery session */
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Logout(discovery) from %s (%s) on"
|
||||
" (%s:%s,%d), ISID=%"PRIx64", TSIH=%u,"
|
||||
" CID=%u, HeaderDigest=%s, DataDigest=%s\n",
|
||||
conn->initiator_name, conn->initiator_addr,
|
||||
conn->portal_host, conn->portal_port, conn->pg_tag,
|
||||
conn->sess->isid, conn->sess->tsih, conn->cid,
|
||||
(spdk_iscsi_param_eq_val(conn->params, "HeaderDigest", "CRC32C")
|
||||
? "on" : "off"),
|
||||
(spdk_iscsi_param_eq_val(conn->params, "DataDigest", "CRC32C")
|
||||
? "on" : "off"));
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
{
|
||||
@ -2539,42 +2579,7 @@ iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu
|
||||
rsph->time_2_wait = 0;
|
||||
rsph->time_2_retain = 0;
|
||||
|
||||
spdk_iscsi_conn_write_pdu(conn, rsp_pdu, spdk_iscsi_conn_pdu_generic_complete, NULL);
|
||||
|
||||
if (conn->sess == NULL) {
|
||||
/*
|
||||
* login failed but initiator still sent a logout rather than
|
||||
* just closing the TCP connection.
|
||||
*/
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Logout(login failed) from %s (%s) on"
|
||||
" (%s:%s,%d)\n",
|
||||
conn->initiator_name, conn->initiator_addr,
|
||||
conn->portal_host, conn->portal_port, conn->pg_tag);
|
||||
} else if (spdk_iscsi_param_eq_val(conn->sess->params, "SessionType", "Normal")) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Logout from %s (%s) on %s tgt_node%d"
|
||||
" (%s:%s,%d), ISID=%"PRIx64", TSIH=%u,"
|
||||
" CID=%u, HeaderDigest=%s, DataDigest=%s\n",
|
||||
conn->initiator_name, conn->initiator_addr,
|
||||
conn->target->name, conn->target->num,
|
||||
conn->portal_host, conn->portal_port, conn->pg_tag,
|
||||
conn->sess->isid, conn->sess->tsih, conn->cid,
|
||||
(spdk_iscsi_param_eq_val(conn->params, "HeaderDigest", "CRC32C")
|
||||
? "on" : "off"),
|
||||
(spdk_iscsi_param_eq_val(conn->params, "DataDigest", "CRC32C")
|
||||
? "on" : "off"));
|
||||
} else {
|
||||
/* discovery session */
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Logout(discovery) from %s (%s) on"
|
||||
" (%s:%s,%d), ISID=%"PRIx64", TSIH=%u,"
|
||||
" CID=%u, HeaderDigest=%s, DataDigest=%s\n",
|
||||
conn->initiator_name, conn->initiator_addr,
|
||||
conn->portal_host, conn->portal_port, conn->pg_tag,
|
||||
conn->sess->isid, conn->sess->tsih, conn->cid,
|
||||
(spdk_iscsi_param_eq_val(conn->params, "HeaderDigest", "CRC32C")
|
||||
? "on" : "off"),
|
||||
(spdk_iscsi_param_eq_val(conn->params, "DataDigest", "CRC32C")
|
||||
? "on" : "off"));
|
||||
}
|
||||
spdk_iscsi_conn_write_pdu(conn, rsp_pdu, iscsi_conn_logout_pdu_complete, conn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user