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: Lance Hartmann <lance.hartmann@oracle.com> Reviewed-on: https://review.gerrithub.io/403878 Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
6c07ca54f3
commit
b080d5a875
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user