From c3d1e498d5ccf9ef4cb4536e6dbe636495adf3a7 Mon Sep 17 00:00:00 2001 From: GangCao Date: Tue, 18 Jun 2019 17:28:11 -0400 Subject: [PATCH] iscsi: update the error message for the login init Change-Id: Ic6baf284753c625d9f1d3110149f67ce4b48c0e7 Signed-off-by: GangCao Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458406 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk --- lib/iscsi/iscsi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 560c8a091..792c8575f 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -1873,7 +1873,9 @@ iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, rsp_pdu->data = calloc(1, *alloc_len); if (!rsp_pdu->data) { SPDK_ERRLOG("calloc() failed for data segment\n"); - return -ENOMEM; + rsph->status_class = ISCSI_CLASS_TARGET_ERROR; + rsph->status_detail = ISCSI_LOGIN_STATUS_NO_RESOURCES; + return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; } reqh = (struct iscsi_bhs_login_req *)&pdu->bhs; @@ -1922,6 +1924,8 @@ iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, if (ISCSI_BHS_LOGIN_GET_TBIT(rsph->flags) && ISCSI_BHS_LOGIN_GET_CBIT(rsph->flags)) { SPDK_ERRLOG("transit error\n"); + rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR; + rsph->status_detail = ISCSI_LOGIN_INITIATOR_ERROR; return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; } /* make sure reqh->version_max < ISCSI_VERSION */