iscsi: set the rsph with correct error information

In several error cases, the status_class and status_detail
is not properly set.

Change-Id: Ie9cf8ec13b971d7295862872e8c7e834d08e7f14
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
GangCao 2019-06-13 18:23:52 -04:00 committed by Changpeng Liu
parent ba3adc4367
commit f874737792

View File

@ -1483,7 +1483,10 @@ iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn,
if (strlen(target_short_name) >= MAX_TARGET_NAME) {
SPDK_ERRLOG("Target Short Name (%s) is more than %u characters\n",
target_short_name, MAX_TARGET_NAME);
return rc;
/* Invalid request */
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
rsph->status_detail = ISCSI_LOGIN_INVALID_LOGIN_REQUEST;
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
}
snprintf(conn->target_short_name, MAX_TARGET_NAME, "%s",
target_short_name);
@ -1513,11 +1516,17 @@ iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn,
rc = iscsi_op_login_negotiate_chap_param(conn, *target);
pthread_mutex_unlock(&((*target)->mutex));
if (rc != 0) {
return rc;
if (rc == 0) {
rc = iscsi_op_login_negotiate_digest_param(conn, *target);
}
return iscsi_op_login_negotiate_digest_param(conn, *target);
if (rc != 0) {
/* Invalid request */
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
rsph->status_detail = ISCSI_LOGIN_INVALID_LOGIN_REQUEST;
}
return rc;
}
/*