Commit b080d5a8 authored by Lance Hartmann's avatar Lance Hartmann Committed by Jim Harris
Browse files

iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_send_r2t()



Prepares spdk_iscsi_send_r2t() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: Id18c39a7ea0ea748f1ecb842aee9a08594fb2a48
Signed-off-by: default avatarLance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403878


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 6c07ca54
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -3989,6 +3989,7 @@ spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn,
	struct iscsi_bhs_r2t *rsph;
	uint32_t transfer_len;
	uint32_t len;
	int rc;

	/* remove the r2t pdu from the snack_list */
	pdu = spdk_iscsi_remove_r2t_pdu_from_snack_list(conn, task, r2t_sn);
@@ -4020,8 +4021,11 @@ spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn,
		spdk_put_pdu(pdu);

		/* re-send a new r2t pdu */
		spdk_iscsi_send_r2t(conn, task, task->next_expected_r2t_offset,
		rc = spdk_iscsi_send_r2t(conn, task, task->next_expected_r2t_offset,
					 len, task->ttt, &task->R2TSN);
		if (rc < 0) {
			return SPDK_ISCSI_CONNECTION_FATAL;
		}
	}

	return 0;
@@ -4271,6 +4275,9 @@ spdk_iscsi_send_r2t(struct spdk_iscsi_conn *conn,

	/* R2T PDU */
	rsp_pdu = spdk_get_pdu();
	if (rsp_pdu == NULL) {
		return SPDK_ISCSI_CONNECTION_FATAL;
	}
	rsph = (struct iscsi_bhs_r2t *)&rsp_pdu->bhs;
	rsp_pdu->data = NULL;
	rsph->opcode = ISCSI_OP_R2T;