void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd) { const char *name = devclass; if (cmd->request->rq_disk) name = cmd->request->rq_disk->disk_name; __scsi_print_sense(name, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); }
void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) { const char *name = devclass; if (sreq->sr_request->rq_disk) name = sreq->sr_request->rq_disk->disk_name; __scsi_print_sense(name, sreq->sr_sense_buffer, SCSI_SENSE_BUFFERSIZE); }
/* * hp_sw_error_is_retryable - Is an HP-specific check condition retryable? * @req: path activation request * * Examine error codes of request and determine whether the error is retryable. * Some error codes are already retried by scsi-ml (see * scsi_decide_disposition), but some HP specific codes are not. * The intent of this routine is to supply the logic for the HP specific * check conditions. * * Returns: * 1 - command completed with retryable error * 0 - command completed with non-retryable error * * Possible optimizations * 1. More hardware-specific error codes */ static int hp_sw_error_is_retryable(struct request *req) { /* * NOT_READY is known to be retryable * For now we just dump out the sense data and call it retryable */ if (status_byte(req->errors) == CHECK_CONDITION) __scsi_print_sense(DM_HP_HWH_NAME, req->sense, req->sense_len); /* * At this point we don't have complete information about all the error * codes from this hardware, so we are just conservative and retry * when in doubt. */ return 1; }
/* Convert the result to success code */ static int osst_chk_result(struct osst_tape * STp, struct osst_request * SRpnt) { char *name = tape_name(STp); int result = SRpnt->result; u8 * sense = SRpnt->sense, scode; #if DEBUG const char *stp; #endif struct st_cmdstatus *cmdstatp; if (!result) return 0; cmdstatp = &STp->buffer->cmdstat; osst_analyze_sense(SRpnt, cmdstatp); if (cmdstatp->have_sense) scode = STp->buffer->cmdstat.sense_hdr.sense_key; else scode = 0; #if DEBUG if (debugging) { printk(OSST_DEB_MSG "%s:D: Error: %x, cmd: %x %x %x %x %x %x\n", name, result, SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2], SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]); if (scode) printk(OSST_DEB_MSG "%s:D: Sense: %02x, ASC: %02x, ASCQ: %02x\n", name, scode, sense[12], sense[13]); if (cmdstatp->have_sense) __scsi_print_sense("osst ", SRpnt->sense, SCSI_SENSE_BUFFERSIZE); } else #endif if (cmdstatp->have_sense && ( scode != NO_SENSE && scode != RECOVERED_ERROR && /* scode != UNIT_ATTENTION && */ scode != BLANK_CHECK && scode != VOLUME_OVERFLOW && SRpnt->cmd[0] != MODE_SENSE && SRpnt->cmd[0] != TEST_UNIT_READY)) { /* Abnormal conditions for tape */ if (cmdstatp->have_sense) { printk(KERN_WARNING "%s:W: Command with sense data:\n", name); __scsi_print_sense("osst ", SRpnt->sense, SCSI_SENSE_BUFFERSIZE); } else { static int notyetprinted = 1; printk(KERN_WARNING "%s:W: Warning %x (driver bt 0x%x, host bt 0x%x).\n", name, result, driver_byte(result), host_byte(result)); if (notyetprinted) { notyetprinted = 0; printk(KERN_INFO "%s:I: This warning may be caused by your scsi controller,\n", name); printk(KERN_INFO "%s:I: it has been reported with some Buslogic cards.\n", name); } } } STp->pos_unknown |= STp->device->was_reset; if (cmdstatp->have_sense && scode == RECOVERED_ERROR) { STp->recover_count++; STp->recover_erreg++; #if DEBUG if (debugging) { if (SRpnt->cmd[0] == READ_6) stp = "read"; else if (SRpnt->cmd[0] == WRITE_6) stp = "write"; else stp = "ioctl"; printk(OSST_DEB_MSG "%s:D: Recovered %s error (%d).\n", name, stp, STp->recover_count); } #endif if ((sense[2] & 0xe0) == 0) return 0; } return (-EIO); }