Re: BUG: CD driver sends command during host removal

Alan Stern
2004-09-29T19:01:11Z

On 29 Sep 2004, James Bottomley wrote:

> On Wed, 2004-09-29 at 14:02, Luben Tuikov wrote:
> > > According to Documentation/scsi/scsi_mid_low_api.txt, the only possible
> > > error returns are SCSI_MLQUEUE_DEVICE_BUSY and SCSI_MLQUEUE_HOST_BUSY.
> > > Neither is appropriate; should the second one be returned?
> >
> > I believe internally SCSI Core returns DID_ERROR.
>
> For a device that no-longer exists, DID_NO_CONNECT is probably the most
> appropriately descriptive.

Regardless of how descriptive the value is, the code in
scsi_dispatch_cmd treats anything other than SCSI_MLQUEUE_DEVICE_BUSY
as SCSI_MLQUEUE_HOST_BUSY. Will this matter?

On Wed, 29 Sep 2004, Luben Tuikov wrote:

> Hmm, once queuecommand() has been called, SCSI Core *should NOT* touch
> the struct command until the LLDD calls scsi_done() or it times
> out and ownership is given back indirectly via the appropriate
> return result of the times_out() function.

On 29 Sep 2004, James Bottomley wrote:

> 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).

It sounds like the two of you are in contradiction. Should the SCSI core
deallocate in-flight commands without consulting the LLDD or shouldn't it?

Alan Stern