iscsi: Dump PDU contents to know what PDU was sent in illegal state
In some test cases, unknown iSCSI PDU other than the login request has been sent to the iSCSI target when the iSCSI target is not in runnable state, and it has caused failure in iSCSI target. To know what PDU was received by the iSCSI target, this patch changes the iSCSI taget to collect dump of the PDU. SPDK has already the SPDK_LOGDUMP macro but the SPDK_ERRLOGDUMP macro will be appropriate in this use case and added. Then the SPDK_ERRLOGDUMP is used in iSCSI library. We can decode PDU and output any format easy to read by human, but creating good format is not easy task and error prone. So this patch uses simple dump. Dump outputs like: PDU 00000000 40 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 @............... 00000010 0b 06 00 10 ff ff ff ff 00 00 00 5a 00 00 00 03 ...........Z.... 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I3ed2fca7fec24ccff17b89ba749a58c397b72c13 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456952 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
cf680fe47e
commit
6d156d5b7d
@ -98,4 +98,11 @@ __attribute__((constructor)) static void register_flag_##flag(void) \
|
||||
#define SPDK_LOGDUMP(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define SPDK_ERRLOGDUMP(LABEL, BUF, LEN) \
|
||||
do { \
|
||||
if ((LEN)) { \
|
||||
spdk_log_dump(stderr, (LABEL), (BUF), (LEN)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* SPDK_INTERNAL_LOG_H */
|
||||
|
@ -4446,6 +4446,12 @@ init_login_reject_response(struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rs
|
||||
rsph->itt = pdu->bhs.itt;
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_pdu_dump(struct spdk_iscsi_pdu *pdu)
|
||||
{
|
||||
SPDK_ERRLOGDUMP("PDU", (uint8_t *)&pdu->bhs, ISCSI_BHS_LEN);
|
||||
}
|
||||
|
||||
int
|
||||
spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
{
|
||||
@ -4489,6 +4495,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
|
||||
} else if (conn->state == ISCSI_CONN_STATE_INVALID) {
|
||||
SPDK_ERRLOG("before Full Feature\n");
|
||||
iscsi_pdu_dump(pdu);
|
||||
return SPDK_ISCSI_CONNECTION_FATAL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user