Index: cam_periph.c =================================================================== RCS file: /home/ncvs/src/sys/cam/cam_periph.c,v retrieving revision 1.54 diff -u -r1.54 cam_periph.c --- cam_periph.c 18 Oct 2003 11:01:11 -0000 1.54 +++ cam_periph.c 22 Oct 2003 20:08:54 -0000 @@ -994,14 +994,27 @@ scsi_cmd = (struct scsi_start_stop_unit *) &done_ccb->csio.cdb_io.cdb_bytes; if (sense != 0) { + struct ccb_getdev cgd; struct scsi_sense_data *sense; int error_code, sense_key, asc, ascq; + scsi_sense_action err_action; sense = &done_ccb->csio.sense_data; scsi_extract_sense(sense, &error_code, &sense_key, &asc, &ascq); /* + * Grab the inquiry data for this device. + */ + xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, + /*priority*/ 1); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)&cgd); + err_action = scsi_error_action(&done_ccb->csio, + &cgd.inq_data, + ascq); + + /* * If the error is "invalid field in CDB", * and the load/eject flag is set, turn the * flag off and try again. This is just in @@ -1028,12 +1041,15 @@ xpt_action(done_ccb); - } else if (done_ccb->ccb_h.retry_count > 1) { + } else if (done_ccb->ccb_h.retry_count > 1 && + (err_action & SS_MASK) != SS_FAIL) { + /* * In this case, the error recovery * command failed, but we've got * some retries left on it. Give - * it another try. + * it another try unless this is an + * unretryable error. */ /* set the timeout to .5 sec */