Re: BUG: CD driver sends command during host removal

Luben Tuikov
2004-09-29T21:20:47Z

James Bottomley wrote:
> On Wed, 2004-09-29 at 17:07, Mike Anderson wrote:
> > ok, thanks for the clarification. Your previous statement seemed to
> imply
> > once scsi_remove_host was called the LLDD had no responsibility for
> > calling done on commands sent to the LLDDs queuecommand.
>
> Hang on a minute, there are two cases:
>
> Existing in-flight commands:
>
> Here, either the LLD returns done on them or the mid-layer will cancel
> them during the invocation of scsi_remove_host(). In the latter case,
> the LLD doesn't need to call done on them.

Is it possible that there could be a slight race when
the LLDD starts calling scsi_done() on pending commands,
_after_ it has called scsi_remove_host()?

BTW, why have/leave two alternate paths for this behavior?
This may bite us back in the future when things get more
complicated, i.e. dealing with more complicated devices,
transports, etc.

> New Commands going down into queuecommand:
>
> These the LLD must error out (by returning done with an error status).

Right at queuecommand() invocation.

Luben

> > So now that this thread and the other thread related to similar
> > shutdown issues has grown long is the next step to see if we can get the
> > usb queuecommand to return DID_NO_CONNECT in this shutdown case.
>
> Yes, that sounds correct.
>
> James
>
>