ncr5380: Proceed with next command after NCR5380_select() calls scsi_done

If a target disappears from the SCSI bus, NCR5380_select() may
subsequently fail with a time-out. In this situation, scsi_done is
called and NCR5380_select() returns 0. Both hostdata->connected and
hostdata->selecting are NULL and the main loop should proceed with
the next command in the issue queue. Clarify this logic.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Finn Thain 2016-01-03 16:05:17 +11:00 коммит произвёл Martin K. Petersen
Родитель ac9399d095
Коммит 1f1b0c74df
2 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -1007,14 +1007,18 @@ static void NCR5380_main(struct work_struct *work)
*/ */
if (!NCR5380_select(instance, tmp)) { if (!NCR5380_select(instance, tmp)) {
break; /* OK or bad target */
} else { } else {
/* Need to retry */
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
tmp->host_scribble = (unsigned char *) hostdata->issue_queue; tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = tmp; hostdata->issue_queue = tmp;
done = 0; done = 0;
dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main(): select() failed, returned to issue_queue\n", instance->host_no); dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main(): select() failed, returned to issue_queue\n", instance->host_no);
} }
if (hostdata->connected ||
hostdata->selecting)
break;
/* lock held here still */ /* lock held here still */
} /* if target/lun is not busy */ } /* if target/lun is not busy */
} /* for */ } /* for */
@ -1024,7 +1028,7 @@ static void NCR5380_main(struct work_struct *work)
tmp = (struct scsi_cmnd *) hostdata->selecting; tmp = (struct scsi_cmnd *) hostdata->selecting;
/* Selection will drop and retake the lock */ /* Selection will drop and retake the lock */
if (!NCR5380_select(instance, tmp)) { if (!NCR5380_select(instance, tmp)) {
/* Ok ?? */ /* OK or bad target */
} else { } else {
/* RvC: device failed, so we wait a long time /* RvC: device failed, so we wait a long time
this is needed for Mustek scanners, that this is needed for Mustek scanners, that

Просмотреть файл

@ -1139,13 +1139,13 @@ static void NCR5380_main(struct work_struct *work)
cmd_get_tag(tmp, tmp->cmnd[0] != REQUEST_SENSE); cmd_get_tag(tmp, tmp->cmnd[0] != REQUEST_SENSE);
#endif #endif
if (!NCR5380_select(instance, tmp)) { if (!NCR5380_select(instance, tmp)) {
/* OK or bad target */
local_irq_disable(); local_irq_disable();
hostdata->retain_dma_intr--; hostdata->retain_dma_intr--;
/* release if target did not response! */
maybe_release_dma_irq(instance); maybe_release_dma_irq(instance);
local_irq_restore(flags); local_irq_restore(flags);
break;
} else { } else {
/* Need to retry */
local_irq_disable(); local_irq_disable();
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
SET_NEXT(tmp, hostdata->issue_queue); SET_NEXT(tmp, hostdata->issue_queue);
@ -1157,9 +1157,9 @@ static void NCR5380_main(struct work_struct *work)
local_irq_restore(flags); local_irq_restore(flags);
dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, " dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, "
"returned to issue_queue\n", HOSTNO); "returned to issue_queue\n", HOSTNO);
}
if (hostdata->connected) if (hostdata->connected)
break; break;
}
} /* if target/lun/target queue is not busy */ } /* if target/lun/target queue is not busy */
} /* for issue_queue */ } /* for issue_queue */
} /* if (!hostdata->connected) */ } /* if (!hostdata->connected) */