lib/iscsi: Call iscsi_reject() in return statements in iscsi_pdu_hdr_op_data()
iSCSI library had used goto label to consolidate iscsi_reject() calls but calling iscsi_reject() in return statements will be simpler and easier to read. This patch series focuses on Data-OUT PDU processing, and so change goto label to function call in return statements for Data-OUT PDU first. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I5f30aff764820aab87233ea8cf22263611591a96 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6533 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
b8d548911b
commit
5261f638cb
@ -4153,7 +4153,6 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
uint32_t len;
|
||||
int F_bit;
|
||||
int rc;
|
||||
int reject_reason = ISCSI_REASON_INVALID_PDU_FIELD;
|
||||
|
||||
if (conn->sess->session_type == SESSION_TYPE_DISCOVERY) {
|
||||
SPDK_ERRLOG("ISCSI_OP_SCSI_DATAOUT not allowed in discovery session\n");
|
||||
@ -4168,14 +4167,13 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
buffer_offset = from_be32(&reqh->buffer_offset);
|
||||
|
||||
if (pdu->data_segment_len > SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
|
||||
reject_reason = ISCSI_REASON_PROTOCOL_ERROR;
|
||||
goto reject_return;
|
||||
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
|
||||
}
|
||||
|
||||
task = get_transfer_task(conn, transfer_tag);
|
||||
if (task == NULL) {
|
||||
SPDK_ERRLOG("Not found task for transfer_tag=%x\n", transfer_tag);
|
||||
goto reject_return;
|
||||
return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD);
|
||||
}
|
||||
|
||||
lun_dev = spdk_scsi_dev_get_lun(conn->dev, task->lun_id);
|
||||
@ -4188,17 +4186,18 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
if (task->tag != task_tag) {
|
||||
SPDK_ERRLOG("The r2t task tag is %u, and the dataout task tag is %u\n",
|
||||
task->tag, task_tag);
|
||||
goto reject_return;
|
||||
return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD);
|
||||
}
|
||||
|
||||
if (DataSN != task->r2t_datasn) {
|
||||
SPDK_ERRLOG("DataSN(%u) exp=%d error\n", DataSN, task->r2t_datasn);
|
||||
if (conn->sess->ErrorRecoveryLevel >= 1) {
|
||||
goto send_r2t_recovery_return;
|
||||
} else {
|
||||
reject_reason = ISCSI_REASON_PROTOCOL_ERROR;
|
||||
goto reject_return;
|
||||
rc = iscsi_send_r2t_recovery(conn, task, task->acked_r2tsn, true);
|
||||
if (rc == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
|
||||
}
|
||||
|
||||
if (buffer_offset != task->next_expected_r2t_offset) {
|
||||
@ -4264,15 +4263,6 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
|
||||
pdu->task = subtask;
|
||||
return 0;
|
||||
|
||||
send_r2t_recovery_return:
|
||||
rc = iscsi_send_r2t_recovery(conn, task, task->acked_r2tsn, true);
|
||||
if (rc == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
reject_return:
|
||||
return iscsi_reject(conn, pdu, reject_reason);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user