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); } }