lib/iscsi: Add a flag to struct spdk_iscsi_pdu to know if it is rejected

The subsequent patches will separate PDU header handling and PDU
payload handling. But for the PDUs which have data segment,
if PDU header is correct, we have to read data segment even if any other
error is found and the PDU is rejected.

To do that, add a flag is_rejected to pass if the PDU is rejected or
not from PDU header handling to PDU payload handling.

If PDU payload handling sees the PDU is already relected, do nothing.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie3fe518fc0f452da9965a2fe3642568c86866480
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471005
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-10-10 14:13:49 +09:00 committed by Tomasz Zawadzki
parent 6fa12139d7
commit 8f3fa385b7
2 changed files with 3 additions and 0 deletions

View File

@ -250,6 +250,8 @@ iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
int data_len;
int alloc_len;
pdu->is_rejected = true;
total_ahs_len = pdu->bhs.total_ahs_len;
data_len = 0;
alloc_len = ISCSI_BHS_LEN + (4 * total_ahs_len);

View File

@ -164,6 +164,7 @@ struct spdk_mobj {
struct spdk_iscsi_pdu {
struct iscsi_bhs bhs;
struct spdk_mobj *mobj;
bool is_rejected;
uint8_t *data_buf;
uint8_t *data;
uint8_t header_digest[ISCSI_DIGEST_LEN];