iscsi: Handle the error case for large IO read.

There is one scenario, when one large read IO is splitted into several
subtasks 1 - N, and the subtask N return successful, it will be stored
in the subtask_list of primary task, but the other tasks could return
error, then when we try to return the subtask N, it will failed, this patch
will make sure the large read IO command return correctly if any of the
subtasks failed.

Change-Id: Ie6bcb79a081acf30f4e4c177c0f7568495ff2b71
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/373450
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Cunyin Chang 2017-08-09 15:22:23 +08:00 committed by Daniel Verkamp
parent a171aba831
commit cd94507607

View File

@ -992,6 +992,15 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *tmp;
bool flag = false;
if (task->scsi.status != SPDK_SCSI_STATUS_GOOD) {
TAILQ_FOREACH(tmp, &primary->subtask_list, subtask_link) {
memcpy(tmp->scsi.sense_data, task->scsi.sense_data,
task->scsi.sense_data_len);
tmp->scsi.sense_data_len = task->scsi.sense_data_len;
tmp->scsi.status = task->scsi.status;
}
}
if ((task != primary) &&
(task->scsi.offset != primary->bytes_completed)) {
TAILQ_FOREACH(tmp, &primary->subtask_list, subtask_link) {