From 0326031ecd05d3b6426ed46a06720830e49448e9 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 8 Nov 2019 16:37:13 +0900 Subject: [PATCH] lib/iscsi: Do not overwrite primary->lun even when LUN removal is notified In spdk_iscsi_conn_handle_queued_datain_tasks(), we had overwritten task->scsi.lun. However, if the primary task is already submitted, it cannot process IO completion correctly because task->scsi.lun is NULL. This patch fixes the issue. Signed-off-by: Shuhei Matsumoto Change-Id: Ia63f4c2e37b43477eaccbfd6dfea28fa357bde12 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473627 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Ziye Yang --- lib/iscsi/iscsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 135e81548..e2912ebaa 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -3253,8 +3253,7 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) assert(task->current_datain_offset <= task->scsi.transfer_len); if (task->current_datain_offset == 0) { - task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->lun_id); - if (task->scsi.lun == NULL) { + if (spdk_scsi_dev_get_lun(conn->dev, task->lun_id) == NULL) { TAILQ_REMOVE(&conn->queued_datain_tasks, task, link); spdk_scsi_task_process_null_lun(&task->scsi); spdk_iscsi_task_cpl(&task->scsi); @@ -3278,8 +3277,7 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) task->current_datain_offset += subtask->scsi.length; conn->data_in_cnt++; - task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->lun_id); - if (task->scsi.lun == NULL) { + if (spdk_scsi_dev_get_lun(conn->dev, task->lun_id) == 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);