Commit a171aba8 authored by Cunyin Chang's avatar Cunyin Chang Committed by Daniel Verkamp
Browse files

iscsi: Fix the corner case when test hotplug with iscsi tgt.



Change-Id: If6d2f3ba4f03430c5d1ceac6fc819d696656e607
Signed-off-by: default avatarCunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/373425


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 59379d4f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2726,6 +2726,11 @@ spdk_iscsi_transfer_in(struct spdk_iscsi_conn *conn,
	if (task->scsi.status != SPDK_SCSI_STATUS_GOOD) {
		if (task != primary) {
			conn->data_in_cnt--;
			/* Handle the case when primary task return success but the subtask failed */
			if (primary->bytes_completed == primary->scsi.transfer_len &&
			    primary->scsi.status == SPDK_SCSI_STATUS_GOOD) {
				conn->data_in_cnt--;
			}
		} else {
			/* handle the case that it is a primary task which has subtasks */
			if (primary->scsi.transfer_len != task->scsi.length) {
@@ -2893,6 +2898,10 @@ int spdk_iscsi_conn_handle_queued_tasks(struct spdk_iscsi_conn *conn)

			task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->scsi.lun_id);
			if (task->scsi.lun == NULL) {
				/* Remove the primary task from the list if this is the last subtask */
				if (task->current_datain_offset == task->scsi.transfer_len) {
					TAILQ_REMOVE(&conn->queued_datain_tasks, task, link);
				}
				subtask->scsi.transfer_len = subtask->scsi.length;
				spdk_scsi_task_process_null_lun(&subtask->scsi);
				spdk_iscsi_task_cpl(&subtask->scsi);