lib/iscsi: Re-check primary task in SCSI Data-Out PDU payload handler

We had checked LUN again but we had not checked primary task
in iscsi_pdu_payload_op_data().  This had caused unexpected behavior
during LUN hotplug.  Hence we check if primary task exists again
in iscsi_pdu_payload_op_data(), and abort the subtask immediately
if not.

This change fixes one of the failures we observed.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5315badf0b90902e77dd5270dd0eda1437a771da
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474440
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-11-15 14:44:46 +09:00 committed by Tomasz Zawadzki
parent 6e4e85dcef
commit 0110aad718

View File

@ -4511,7 +4511,9 @@ reject_return:
static int
iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
{
struct spdk_iscsi_task *subtask;
struct spdk_iscsi_task *subtask;
struct iscsi_bhs_data_out *reqh;
uint32_t transfer_tag;
if (pdu->task == NULL) {
return 0;
@ -4519,6 +4521,17 @@ iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
subtask = pdu->task;
reqh = (struct iscsi_bhs_data_out *)&pdu->bhs;
transfer_tag = from_be32(&reqh->ttt);
if (get_transfer_task(conn, transfer_tag) == NULL) {
SPDK_ERRLOG("Not found for transfer_tag=%x\n", transfer_tag);
subtask->scsi.transfer_len = subtask->scsi.length;
spdk_scsi_task_process_abort(&subtask->scsi);
spdk_iscsi_task_cpl(&subtask->scsi);
return 0;
}
if (spdk_likely(!pdu->dif_insert_or_strip)) {
spdk_scsi_task_set_data(&subtask->scsi, pdu->data, pdu->data_segment_len);
} else {