Commit f5794d08 authored by Ziye Yang's avatar Ziye Yang Committed by Daniel Verkamp
Browse files

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: default avatarZiye Yang <ziye.yang@intel.com>
parent ac6e7699
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -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);

	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) &&
					    (offset > 0)) {
					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));
							}
						}

						spdk_iscsi_conn_handle_queued_datain(conn);
					}

					spdk_iscsi_task_put(pdu->task);
				}
				spdk_put_pdu(pdu);
			}