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 <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia63f4c2e37b43477eaccbfd6dfea28fa357bde12
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473627
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-11-08 16:37:13 +09:00 committed by Tomasz Zawadzki
parent d115518ba0
commit 0326031ecd

View File

@ -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);