iscsi: fix the pdu memory leak issue
It is pdu memory leak issue. The reason is that we did not correctly handle the read pdu task. Change-Id: I719c87fe7825537b9c77f5ee7e0816671de4c051 Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
9c04f2f1f9
commit
7c5ed138b4
@ -810,14 +810,9 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
|
|||||||
bool flag = false;
|
bool flag = false;
|
||||||
|
|
||||||
primary = spdk_iscsi_task_get_primary(task);
|
primary = spdk_iscsi_task_get_primary(task);
|
||||||
if (task != primary) {
|
|
||||||
if (task->scsi.offset == primary->scsi.bytes_completed) {
|
if ((task != primary) &&
|
||||||
primary->scsi.bytes_completed += task->scsi.length;
|
(task->scsi.offset != primary->scsi.bytes_completed)) {
|
||||||
spdk_iscsi_task_response(conn, task);
|
|
||||||
spdk_iscsi_task_put(task);
|
|
||||||
process_completed_read_subtask_list(conn, primary);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TAILQ_FOREACH(tmp, &primary->scsi.subtask_list, scsi_link) {
|
TAILQ_FOREACH(tmp, &primary->scsi.subtask_list, scsi_link) {
|
||||||
if (task->scsi.offset < tmp->offset) {
|
if (task->scsi.offset < tmp->offset) {
|
||||||
TAILQ_INSERT_BEFORE(tmp, &task->scsi, scsi_link);
|
TAILQ_INSERT_BEFORE(tmp, &task->scsi, scsi_link);
|
||||||
@ -828,11 +823,13 @@ process_read_task_completion(struct spdk_iscsi_conn *conn,
|
|||||||
if (!flag) {
|
if (!flag) {
|
||||||
TAILQ_INSERT_TAIL(&primary->scsi.subtask_list, &task->scsi, scsi_link);
|
TAILQ_INSERT_TAIL(&primary->scsi.subtask_list, &task->scsi, scsi_link);
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
primary->scsi.bytes_completed += primary->scsi.length;
|
|
||||||
spdk_iscsi_task_response(conn, primary);
|
|
||||||
process_completed_read_subtask_list(conn, primary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
primary->scsi.bytes_completed += task->scsi.length;
|
||||||
|
spdk_iscsi_task_response(conn, task);
|
||||||
|
spdk_iscsi_task_put(task);
|
||||||
|
process_completed_read_subtask_list(conn, primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_task_completion(spdk_event_t event)
|
void process_task_completion(spdk_event_t event)
|
||||||
@ -1033,19 +1030,14 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
|
|||||||
tailq);
|
tailq);
|
||||||
} else {
|
} else {
|
||||||
if (pdu->task) {
|
if (pdu->task) {
|
||||||
if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) {
|
uint64_t offset = pdu->task->scsi.offset;
|
||||||
struct spdk_iscsi_task *primary;
|
spdk_iscsi_task_put(pdu->task);
|
||||||
|
|
||||||
primary = spdk_iscsi_task_get_primary(pdu->task);
|
if ((pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) &&
|
||||||
if (pdu->task->scsi.offset > 0) {
|
(offset > 0)) {
|
||||||
conn->data_in_cnt--;
|
conn->data_in_cnt--;
|
||||||
}
|
|
||||||
if (pdu->bhs.flags & ISCSI_DATAIN_STATUS) {
|
|
||||||
spdk_iscsi_task_put(primary);
|
|
||||||
}
|
|
||||||
spdk_iscsi_conn_handle_queued_datain(conn);
|
spdk_iscsi_conn_handle_queued_datain(conn);
|
||||||
}
|
}
|
||||||
spdk_iscsi_task_put(pdu->task);
|
|
||||||
}
|
}
|
||||||
spdk_put_pdu(pdu);
|
spdk_put_pdu(pdu);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user