eh_abort_handler and calling scsi_done
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.
Quoted 1 line
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
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
Quoted 33 lines · Christof Schmitt
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 callscsi_doneany time later (probably latest when theeh_host_reset_handlerflushes everything that is still pending).2) While the abort is pending, but before returning SUCCESS from
eh_abort_handler, the LLD can still callscsi_donefor 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Brian King Linux on Power Virtualization IBM Linux Technology Center
Quoted 3 lines · Brian King
Your assessment sounds correct to me. The other caveat to note is that if for some reason in your
eh_abort_handleryou 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
Quoted 4 lines · Brian King
Your assessment sounds correct to me. The other caveat to note is that if for some reason in your
eh_abort_handleryou don't think the command is still outstanding, you should return SUCCESS for this as well.
Quoted 27 lines
-Brian
Quoted 24 lines · Christof Schmitt
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 callscsi_doneany time later (probably latest when theeh_host_reset_handlerflushes everything that is still pending).2) While the abort is pending, but before returning SUCCESS from
eh_abort_handler, the LLD can still callscsi_donefor 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
[email protected]
Quoted 33 lines · Mike Anderson
Quoted 4 lines · Brian King
Your assessment sounds correct to me. The other caveat to note is that if for some reason in your
eh_abort_handleryou don't think the command is still outstanding, you should return SUCCESS for this as well.Quoted 27 lines
-Brian
Quoted 24 lines · Christof Schmitt
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 callscsi_doneany time later (probably latest when theeh_host_reset_handlerflushes everything that is still pending).2) While the abort is pending, but before returning SUCCESS from
eh_abort_handler, the LLD can still callscsi_donefor 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).
Quoted 4 lines
In cases 1 and 2 above calling
scsi_donecan be done but will cause the request to be stopped inblk_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
Quoted 38 lines · Christof Schmitt
Quoted 32 lines · Mike Anderson
Quoted 4 lines · Brian King
Your assessment sounds correct to me. The other caveat to note is that if for some reason in your
eh_abort_handleryou don't think the command is still outstanding, you should return SUCCESS for this as well.Quoted 27 lines
-Brian
Quoted 24 lines · Christof Schmitt
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 callscsi_doneany time later (probably latest when theeh_host_reset_handlerflushes everything that is still pending).2) While the abort is pending, but before returning SUCCESS from
eh_abort_handler, the LLD can still callscsi_donefor 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).Quoted 4 lines
In cases 1 and 2 above calling
scsi_donecan be done but will cause the request to be stopped inblk_complete_request(scsi_done->blk_complete_request) as the timed out handler has already taken ownership of the command.
Quoted 4 lines
I am not too familiar with the blk completion handling. Would calling
scsi_donefor the cases above cause any problems? If there are reasons not to callscsi_donehere, 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
Signature · 3 lines
Brian King Linux on Power Virtualization IBM Linux Technology Center