diff options
author | ken <ken@FreeBSD.org> | 1998-09-19 01:23:04 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 1998-09-19 01:23:04 +0000 |
commit | fb53c69912b8cf3f11b3513f209c78221a194560 (patch) | |
tree | 9276de7152fe6341136f114f3e71735367ed8f5c | |
parent | 0fe004dcfa6aee4ea06be46072c2bd15846f2154 (diff) | |
download | FreeBSD-src-fb53c69912b8cf3f11b3513f209c78221a194560.zip FreeBSD-src-fb53c69912b8cf3f11b3513f209c78221a194560.tar.gz |
Fix error recovery in scsi_interpret_sense(). It turns out that ERESTART
wasn't getting sent back for most errors, even if there were retries left
on the command. I'm not sure how I ever let this slip by before...
In any case, we now send back ERESTART if there are retries left for the
command, and send back the default error code when there are no retries
left.
Reviewed by: gibbs
-rw-r--r-- | sys/cam/scsi/scsi_all.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 4f892bd..8d8132d 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_all.c,v 1.1 1998/09/15 06:36:33 gibbs Exp $ + * $Id: scsi_all.c,v 1.2 1998/09/18 22:33:59 ken Exp $ */ #include <sys/param.h> @@ -2128,13 +2128,16 @@ scsi_interpret_sense(struct cam_device *device, union ccb *ccb, case SSD_KEY_BLANK_CHECK: /* should be filtered out by peripheral drivers */ retry = ccb->ccb_h.retry_count > 0; - if (retry) + if (retry) { ccb->ccb_h.retry_count--; - - if ((error_action & SSQ_PRINT_SENSE) == 0) + error = ERESTART; print_sense = FALSE; + } else { + if ((error_action & SSQ_PRINT_SENSE) == 0) + print_sense = FALSE; - error = error_action & SS_ERRMASK; + error = error_action & SS_ERRMASK; + } break; case SSD_KEY_UNIT_ATTENTION: @@ -2150,34 +2153,43 @@ scsi_interpret_sense(struct cam_device *device, union ccb *ccb, } else { /* decrement the number of retries */ retry = ccb->ccb_h.retry_count > 0; - if (retry) + if (retry) { ccb->ccb_h.retry_count--; - - if ((error_action & SSQ_PRINT_SENSE) == 0) + error = ERESTART; print_sense = FALSE; + } else { + if ((error_action & SSQ_PRINT_SENSE)==0) + print_sense = FALSE; - error = error_action & SS_ERRMASK; + error = error_action & SS_ERRMASK; + } } break; default: /* decrement the number of retries */ retry = ccb->ccb_h.retry_count > 0; - if (retry) + if (retry) { ccb->ccb_h.retry_count--; - - if ((error_action & SSQ_PRINT_SENSE) == 0) + error = ERESTART; print_sense = FALSE; + } else { + if ((error_action & SSQ_PRINT_SENSE) == 0) + print_sense = FALSE; - error = error_action & SS_ERRMASK; + error = error_action & SS_ERRMASK; + } } break; } default: /* decrement the number of retries */ retry = ccb->ccb_h.retry_count > 0; - if (retry) + if (retry) { ccb->ccb_h.retry_count--; - error =EIO; + error = ERESTART; + print_sense = FALSE; + } else + error = EIO; break; } |