iscsi: fix the large read handling logic

My previous pdu leak fixing patch breaks the
large logic for large read, and this patch
fixes this.

Change-Id: Ic3f654527f7addd4ee45aad53a752de72a84edfd
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-09-14 09:38:01 +08:00 committed by Daniel Verkamp
parent ac6e76991d
commit f5794d088e

View File

@ -828,7 +828,11 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
primary->scsi.bytes_completed += task->scsi.length;
spdk_iscsi_task_response(conn, task);
spdk_iscsi_task_put(task);
if ((task != primary) ||
(task->scsi.transfer_len == task->scsi.length)) {
spdk_iscsi_task_put(task);
}
process_completed_read_subtask_list(conn, primary);
}
@ -1030,14 +1034,18 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
tailq);
} else {
if (pdu->task) {
uint64_t offset = pdu->task->scsi.offset;
spdk_iscsi_task_put(pdu->task);
if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) {
if (pdu->task->scsi.offset > 0) {
conn->data_in_cnt--;
if (pdu->bhs.flags & ISCSI_DATAIN_STATUS) {
spdk_iscsi_task_put(spdk_iscsi_task_get_primary(pdu->task));
}
}
if ((pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) &&
(offset > 0)) {
conn->data_in_cnt--;
spdk_iscsi_conn_handle_queued_datain(conn);
}
spdk_iscsi_task_put(pdu->task);
}
spdk_put_pdu(pdu);
}