Re: Questions about scsi_target_reap and starget/sdev lifecyle

Alan Stern
2005-06-21T21:22:21Z

On Tue, 21 Jun 2005, Mike Anderson wrote:

> I have asked this multiple times, but I will again. If the hba knows to
> fail everything by some internal state in the LLDD why does it not also
> know to flush all commands back to the scsi mid layer in this unplugged
> state so we do not have to deal with canceling them from the mid-layer.

With usb-storage, part of it is my fault. It never occurred to me that we
should fail all outstanding commands prior to calling scsi_remove_host,
since I expected the midlayer to take care of things. I'll try changing
usb-storage and see if it works with scsi_host_cancel coming after
scsi_forget_host (or even removed entirely!).

> I think it has been stated many times if commands always go in through
> queuecommand and always return through scsi_done it makes the chances of
> errors a lot less.

I agree. The current state must have arisen for historical reasons.

Alan Stern