Unify SCSI_STATUS_BUSY retry handling with other cases.

- Do not retry if periph was invalidated.
 - Do not decrement retry_count if already zero.
 - Report action_string when applicable.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2019-04-02 14:46:10 +00:00
parent 4551884596
commit 99bad9ca9a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345805

View File

@ -1513,6 +1513,7 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb,
int *openings, u_int32_t *relsim_flags,
u_int32_t *timeout, u_int32_t *action, const char **action_string)
{
struct cam_periph *periph;
int error;
switch (ccb->csio.scsi_status) {
@ -1595,14 +1596,21 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb,
* Restart the queue after either another
* command completes or a 1 second timeout.
*/
if ((sense_flags & SF_RETRY_BUSY) != 0 ||
(ccb->ccb_h.retry_count--) > 0) {
periph = xpt_path_periph(ccb->ccb_h.path);
if (periph->flags & CAM_PERIPH_INVALID) {
error = EIO;
*action_string = "Periph was invalidated";
} else if ((sense_flags & SF_RETRY_BUSY) != 0 ||
ccb->ccb_h.retry_count > 0) {
if ((sense_flags & SF_RETRY_BUSY) == 0)
ccb->ccb_h.retry_count--;
error = ERESTART;
*relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT
| RELSIM_RELEASE_AFTER_CMDCMPLT;
*timeout = 1000;
} else {
error = EIO;
*action_string = "Retries exhausted";
}
break;
case SCSI_STATUS_RESERV_CONFLICT: