Commit 0110aad7 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5315badf0b90902e77dd5270dd0eda1437a771da
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474440


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 6e4e85dc
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -4512,6 +4512,8 @@ static int
iscsi_pdu_payload_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
{
	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 {