lib/iscsi: fix op_logout rsph->response judgement

According to iSCSI 7143 spec 11.15.1 (3720 spec 10.15.1),
Rsph->response should be 0 if connection or session closed successfully.

The current code mistakenly compared cid provided by initiator with
inner conn->id parameter, which does not follow the spec.

Change-Id: I12dbb3471be5d49380c6b65bcdb67c57df11665f
Signed-off-by: ShadowMov <jinnian.hjn@alibaba-inc.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5731
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
ShadowMov 2020-12-30 12:04:10 +08:00 committed by Tomasz Zawadzki
parent ab27b2c4d2
commit d2b0b15406
2 changed files with 2 additions and 2 deletions

View File

@ -2564,7 +2564,7 @@ iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu
/* ignore error */
}
if (conn->id == cid) {
if (conn->cid == cid) {
/* connection or session closed successfully */
response = 0;
iscsi_conn_logout(conn);

View File

@ -1537,7 +1537,7 @@ pdu_hdr_op_logout_test(void)
sess.ExpCmdSN = 5679;
sess.connections = 1;
conn.sess = &sess;
conn.id = 1;
conn.cid = 1;
rc = iscsi_pdu_hdr_op_logout(&conn, &pdu);
CU_ASSERT(rc == 0);