From b865439deb92f395340030139b5c488a6ba26d3e Mon Sep 17 00:00:00 2001 From: Cunyin Chang Date: Thu, 19 Jan 2017 19:38:54 +0800 Subject: [PATCH] iscsi: Fix the large IO failure procedure in iscsi layer This patch fix the issue when large IO failed: when we handle the read command which need split, we need make sure all the subtasks to be handled if one of the subtask failed, this will make sure the command have chance return back to initiator. Change-Id: I0c01e1a34c6179fce37ab52c8121268b6ee31102 Signed-off-by: Cunyin Chang --- lib/iscsi/conn.c | 5 +++++ lib/iscsi/iscsi.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index fc44f3f3e0..90d2365bc3 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -427,6 +427,11 @@ spdk_iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pd } spdk_iscsi_conn_handle_queued_tasks(conn); } + } else if (pdu->bhs.opcode == ISCSI_OP_SCSI_RSP && + pdu->task->scsi.status != SPDK_SCSI_STATUS_GOOD) { + if (pdu->task->scsi.offset > 0) { + spdk_iscsi_task_put(spdk_iscsi_task_get_primary(pdu->task)); + } } spdk_iscsi_task_put(pdu->task); } diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 037a79b5a1..3086cc42e0 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -2703,11 +2703,12 @@ spdk_iscsi_transfer_in(struct spdk_iscsi_conn *conn, if (task->scsi.status != SPDK_SCSI_STATUS_GOOD) { if (task != primary) { conn->data_in_cnt--; + spdk_iscsi_conn_handle_queued_tasks(conn); } else { /* handle the case that it is a primary task which has subtasks */ if (primary->scsi.transfer_len != task->scsi.length) { conn->data_in_cnt--; - spdk_iscsi_task_put(task); + spdk_iscsi_conn_handle_queued_tasks(conn); } }