From cd94507607746e0ab37281727c0346f492df1f48 Mon Sep 17 00:00:00 2001 From: Cunyin Chang Date: Wed, 9 Aug 2017 15:22:23 +0800 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/373450 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/iscsi/conn.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index cdf31a6b1..102289a47 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -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) {