* eh_abort_handler and calling scsi_done
@ 2009-03-24 11:41 Christof Schmitt
2009-03-24 13:29 ` Brian King
0 siblings, 1 reply; 6+ messages in thread
From: Christof Schmitt @ 2009-03-24 11:41 UTC (permalink / raw)
To: linux-scsi
I am investigating what is required from a LLD when SCSI commands time
out and the SCSI EH calls the eh_abort_handler. The documentation in
scsi_eh.txt states:
<<scsi_eh_abort_cmds>>
This action is taken for each timed out command.
hostt->eh_abort_handler() is invoked for each scmd. The
handler returns SUCCESS if it has succeeded to make LLDD and
all related hardware forget about the scmd.
>From this and from looking at the code, i would conclude:
1) If the LLD returns FAILED from the eh_abort_handler, then the
command is still allowed to be active in the LLD and the LLD can
call scsi_done any time later (probably latest when the
eh_host_reset_handler flushes everything that is still pending).
2) While the abort is pending, but before returning SUCCESS from
eh_abort_handler, the LLD can still call scsi_done for the SCSI
command to be aborted (the SCSI command might be returned with a
status "aborted" if the abort succeeds, or "good" if it was
completed just before the abort reached the storage system).
Is this correct? Are there any more limitations a SCSI LLD has to be
aware of?
--
Christof Schmitt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: eh_abort_handler and calling scsi_done
2009-03-24 11:41 eh_abort_handler and calling scsi_done Christof Schmitt
@ 2009-03-24 13:29 ` Brian King
2009-03-24 14:34 ` Christof Schmitt
2009-03-24 17:46 ` Mike Anderson
0 siblings, 2 replies; 6+ messages in thread
From: Brian King @ 2009-03-24 13:29 UTC (permalink / raw)
To: Christof Schmitt; +Cc: linux-scsi
Your assessment sounds correct to me. The other caveat to note is that
if for some reason in your eh_abort_handler you don't think the command
is still outstanding, you should return SUCCESS for this as well.
-Brian
Christof Schmitt wrote:
> I am investigating what is required from a LLD when SCSI commands time
> out and the SCSI EH calls the eh_abort_handler. The documentation in
> scsi_eh.txt states:
>
> <<scsi_eh_abort_cmds>>
>
> This action is taken for each timed out command.
> hostt->eh_abort_handler() is invoked for each scmd. The
> handler returns SUCCESS if it has succeeded to make LLDD and
> all related hardware forget about the scmd.
>
> From this and from looking at the code, i would conclude:
>
> 1) If the LLD returns FAILED from the eh_abort_handler, then the
> command is still allowed to be active in the LLD and the LLD can
> call scsi_done any time later (probably latest when the
> eh_host_reset_handler flushes everything that is still pending).
>
> 2) While the abort is pending, but before returning SUCCESS from
> eh_abort_handler, the LLD can still call scsi_done for the SCSI
> command to be aborted (the SCSI command might be returned with a
> status "aborted" if the abort succeeds, or "good" if it was
> completed just before the abort reached the storage system).
>
> Is this correct? Are there any more limitations a SCSI LLD has to be
> aware of?
>
> --
> Christof Schmitt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: eh_abort_handler and calling scsi_done
2009-03-24 13:29 ` Brian King
@ 2009-03-24 14:34 ` Christof Schmitt
2009-03-24 17:46 ` Mike Anderson
1 sibling, 0 replies; 6+ messages in thread
From: Christof Schmitt @ 2009-03-24 14:34 UTC (permalink / raw)
To: Brian King; +Cc: linux-scsi
On Tue, Mar 24, 2009 at 08:29:57AM -0500, Brian King wrote:
> Your assessment sounds correct to me. The other caveat to note is that
> if for some reason in your eh_abort_handler you don't think the command
> is still outstanding, you should return SUCCESS for this as well.
True, thanks for the hint.
The idea is that the zfcp driver does not have to break the link
between the FSF and SCSI commands and the abort_lock in the driver can
be removed. I guess, now i have some information to figure out if i
can remove this step and still satisfy the API requirements.
--
Christof Schmitt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: eh_abort_handler and calling scsi_done
2009-03-24 13:29 ` Brian King
2009-03-24 14:34 ` Christof Schmitt
@ 2009-03-24 17:46 ` Mike Anderson
2009-03-25 8:52 ` Christof Schmitt
1 sibling, 1 reply; 6+ messages in thread
From: Mike Anderson @ 2009-03-24 17:46 UTC (permalink / raw)
To: Brian King; +Cc: Christof Schmitt, linux-scsi
Brian King <brking@linux.vnet.ibm.com> wrote:
> Your assessment sounds correct to me. The other caveat to note is that
> if for some reason in your eh_abort_handler you don't think the command
> is still outstanding, you should return SUCCESS for this as well.
>
> -Brian
>
> Christof Schmitt wrote:
> > I am investigating what is required from a LLD when SCSI commands time
> > out and the SCSI EH calls the eh_abort_handler. The documentation in
> > scsi_eh.txt states:
> >
> > <<scsi_eh_abort_cmds>>
> >
> > This action is taken for each timed out command.
> > hostt->eh_abort_handler() is invoked for each scmd. The
> > handler returns SUCCESS if it has succeeded to make LLDD and
> > all related hardware forget about the scmd.
> >
> > From this and from looking at the code, i would conclude:
> >
> > 1) If the LLD returns FAILED from the eh_abort_handler, then the
> > command is still allowed to be active in the LLD and the LLD can
> > call scsi_done any time later (probably latest when the
> > eh_host_reset_handler flushes everything that is still pending).
> >
> > 2) While the abort is pending, but before returning SUCCESS from
> > eh_abort_handler, the LLD can still call scsi_done for the SCSI
> > command to be aborted (the SCSI command might be returned with a
> > status "aborted" if the abort succeeds, or "good" if it was
> > completed just before the abort reached the storage system).
> >
In cases 1 and 2 above calling scsi_done can be done but will cause the
request to be stopped in blk_complete_request (scsi_done->blk_complete_request) as the timed out handler has already taken ownership of the command.
-andmike
--
Michael Anderson
andmike@linux.vnet.ibm.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: eh_abort_handler and calling scsi_done
2009-03-24 17:46 ` Mike Anderson
@ 2009-03-25 8:52 ` Christof Schmitt
2009-03-25 13:52 ` Brian King
0 siblings, 1 reply; 6+ messages in thread
From: Christof Schmitt @ 2009-03-25 8:52 UTC (permalink / raw)
To: Mike Anderson; +Cc: Brian King, linux-scsi
On Tue, Mar 24, 2009 at 10:46:09AM -0700, Mike Anderson wrote:
> Brian King <brking@linux.vnet.ibm.com> wrote:
> > Your assessment sounds correct to me. The other caveat to note is that
> > if for some reason in your eh_abort_handler you don't think the command
> > is still outstanding, you should return SUCCESS for this as well.
> >
> > -Brian
> >
> > Christof Schmitt wrote:
> > > I am investigating what is required from a LLD when SCSI commands time
> > > out and the SCSI EH calls the eh_abort_handler. The documentation in
> > > scsi_eh.txt states:
> > >
> > > <<scsi_eh_abort_cmds>>
> > >
> > > This action is taken for each timed out command.
> > > hostt->eh_abort_handler() is invoked for each scmd. The
> > > handler returns SUCCESS if it has succeeded to make LLDD and
> > > all related hardware forget about the scmd.
> > >
> > > From this and from looking at the code, i would conclude:
> > >
> > > 1) If the LLD returns FAILED from the eh_abort_handler, then the
> > > command is still allowed to be active in the LLD and the LLD can
> > > call scsi_done any time later (probably latest when the
> > > eh_host_reset_handler flushes everything that is still pending).
> > >
> > > 2) While the abort is pending, but before returning SUCCESS from
> > > eh_abort_handler, the LLD can still call scsi_done for the SCSI
> > > command to be aborted (the SCSI command might be returned with a
> > > status "aborted" if the abort succeeds, or "good" if it was
> > > completed just before the abort reached the storage system).
> > >
>
> In cases 1 and 2 above calling scsi_done can be done but will cause
> the request to be stopped in blk_complete_request
> (scsi_done->blk_complete_request) as the timed out handler has
> already taken ownership of the command.
I am not too familiar with the blk completion handling. Would calling
scsi_done for the cases above cause any problems? If there are reasons
not to call scsi_done here, then this could be mentioned in the scsi
documentation file.
--
Christof Schmitt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: eh_abort_handler and calling scsi_done
2009-03-25 8:52 ` Christof Schmitt
@ 2009-03-25 13:52 ` Brian King
0 siblings, 0 replies; 6+ messages in thread
From: Brian King @ 2009-03-25 13:52 UTC (permalink / raw)
To: Christof Schmitt; +Cc: Mike Anderson, linux-scsi
Christof Schmitt wrote:
> On Tue, Mar 24, 2009 at 10:46:09AM -0700, Mike Anderson wrote:
>> Brian King <brking@linux.vnet.ibm.com> wrote:
>>> Your assessment sounds correct to me. The other caveat to note is that
>>> if for some reason in your eh_abort_handler you don't think the command
>>> is still outstanding, you should return SUCCESS for this as well.
>>>
>>> -Brian
>>>
>>> Christof Schmitt wrote:
>>>> I am investigating what is required from a LLD when SCSI commands time
>>>> out and the SCSI EH calls the eh_abort_handler. The documentation in
>>>> scsi_eh.txt states:
>>>>
>>>> <<scsi_eh_abort_cmds>>
>>>>
>>>> This action is taken for each timed out command.
>>>> hostt->eh_abort_handler() is invoked for each scmd. The
>>>> handler returns SUCCESS if it has succeeded to make LLDD and
>>>> all related hardware forget about the scmd.
>>>>
>>>> From this and from looking at the code, i would conclude:
>>>>
>>>> 1) If the LLD returns FAILED from the eh_abort_handler, then the
>>>> command is still allowed to be active in the LLD and the LLD can
>>>> call scsi_done any time later (probably latest when the
>>>> eh_host_reset_handler flushes everything that is still pending).
>>>>
>>>> 2) While the abort is pending, but before returning SUCCESS from
>>>> eh_abort_handler, the LLD can still call scsi_done for the SCSI
>>>> command to be aborted (the SCSI command might be returned with a
>>>> status "aborted" if the abort succeeds, or "good" if it was
>>>> completed just before the abort reached the storage system).
>>>>
>> In cases 1 and 2 above calling scsi_done can be done but will cause
>> the request to be stopped in blk_complete_request
>> (scsi_done->blk_complete_request) as the timed out handler has
>> already taken ownership of the command.
>
> I am not too familiar with the blk completion handling. Would calling
> scsi_done for the cases above cause any problems? If there are reasons
> not to call scsi_done here, then this could be mentioned in the scsi
> documentation file.
No. There is no requirement to call scsi_done for aborted commands,
but there is also no harm in doing so.
-Brian
--
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-25 13:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24 11:41 eh_abort_handler and calling scsi_done Christof Schmitt
2009-03-24 13:29 ` Brian King
2009-03-24 14:34 ` Christof Schmitt
2009-03-24 17:46 ` Mike Anderson
2009-03-25 8:52 ` Christof Schmitt
2009-03-25 13:52 ` Brian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox