Re: BUG: CD driver sends command during host removal

James Bottomley
2004-09-29T19:40:01Z

On Wed, 2004-09-29 at 14:58, Luben Tuikov wrote:
> Does this mean that scsi_device_cancel() should set the result
> code to DID_NO_CONNECT either?

No, I think for in-flight commands, DID_ERROR is the safest. They
could, after all have partially deposited their data load before being
cancelled. DID_NO_CONNECT means that no processing was ever done.

> > Right. scsi_remove_host tells the mid-layer that it's OK to trash all
> > inflight commands because you removed all their users before calling
> > it. It also tells us that you won't accept any future commands for this
> > host (because you'll error any attempt in queuecommand).
>
> Do you mean to say that when scsi_remove_host() is called,
> the LLDD must no own any commands? This is good, it means
> that the LLDD plugged queuecommand(), did "recovery" of
> pending commands and is ready for slave_destroy().

No. It's up to the LLD. If it wants to complete all its commands then
call scsi_remove_host(), that's fine. However it's also fine for it to
call scsi_remove_host() with pending in-flight commands; if it does,
ownership of these is transferred back to the mid-layer and we cancel
them all.

James