Re: Questions about scsi_target_reap and starget/sdev lifecyle

Luben Tuikov
2005-06-22T16:53:25Z

On 06/22/05 12:16, Alan Stern wrote:
> On Wed, 22 Jun 2005, Luben Tuikov wrote:
>
>
>>The notify event can "travel" right behind flush-cache and "close doors"
>>behind. (since it travels from the application client to the device)
>
>
> Are you sure about that? One way to generate such a notify event is to
> rmmod the LLDD. The event is then generated by the LLDD and it travels up
> to the midlayer, by way of scsi_remove_host. You seem to be saying that
> there should be a separate API for the LLDD to notify the midlayer that it
> is about to be unloaded.

Alan, I'd consider this to be "hot-unplug" event (as you describe it).

(In which case the other order of rules apply (set flag for queuecommand(),
empty queues, call scsi_remove_host()).

> So should the midlayer no longer try to cancel outstanding commands when a
> host is removed? Can it rely on the LLDDs to do so?

Well, let's think about it. If the LLDD has emptied its queues, and
the LLDD doesn't own any commands, then the midlayer would have
nothing to cancel (midlayer's pending queue is empty).

Nevertheless, the midlayer should inspect its pending queue to see
if it needs to preempt any outstanding commands, in case the LLDD
didn't return them.

Luben