Commit aad81495 authored by Andries E. Brouwer's avatar Andries E. Brouwer Committed by Linus Torvalds

[PATCH] scsi_error fix

imm.c: spelling
scsi.h: remove old and now incorrect comment
scsi_scan.c: remove superfluous final return
scsi_error.c: apart from similar trivialities the only change:

    If a command fails (e.g. because it belongs to a newer
    SCSI version than the device), it is fed to
    scsi_decide_disposition(). That routine must return
    SUCCESS, unless the error handler should be invoked.

    In the situation where host_byte is DID_OK, and message_byte
    is COMMAND_COMPLETE, and status is CHECK_CONDITION, there is
    no reason at all to invoke aborts and resets. The situation
    is normal. I see here UNIT ATTENTION, Power on occurred
    and ILLEGAL REQUEST, Invalid field in cdb.

    The 2.5.64 code does not return SUCCESS, but it returns the
    return code of scsi_check_sense(), and that may be FAILED
    in case we do not have valid sense.
parent f4196e0e
......@@ -174,6 +174,7 @@ int imm_detect(Scsi_Host_Template * host)
parport_unregister_device(imm_hosts[i].dev);
continue;
}
/* now the glue ... */
switch (imm_hosts[i].mode) {
case IMM_NIBBLE:
......@@ -218,7 +219,7 @@ int imm_detect(Scsi_Host_Template * host)
/* This is to give the imm driver a way to modify the timings (and other
* parameters) by writing to the /proc/scsi/imm/0 file.
* Very simple method really... (To simple, no error checking :( )
* Very simple method really... (Too simple, no error checking :( )
* Reason: Kernel hackers HATE having to unload and reload modules for
* testing...
* Also gives a method to use a script to obtain optimum timings (TODO)
......@@ -948,7 +949,7 @@ static int imm_engine(imm_struct * tmp, Scsi_Cmnd * cmd)
unsigned char l = 0, h = 0;
int retv, x;
/* First check for any errors that may of occurred
/* First check for any errors that may have occurred
* Here we check for internal errors
*/
if (tmp->failed)
......
......@@ -280,26 +280,7 @@ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
#define SCSI_SET_IOCTL_LOGGING(LEVEL) \
SCSI_SET_LOGGING(SCSI_LOG_IOCTL_SHIFT, SCSI_LOG_IOCTL_BITS, LEVEL);
/*
* the return of the status word will be in the following format :
* The low byte is the status returned by the SCSI command,
* with vendor specific bits masked.
*
* The next byte is the message which followed the SCSI status.
* This allows a stos to be used, since the Intel is a little
* endian machine.
*
* The final byte is a host return code, which is one of the following.
*
* IE
* lsb msb
* status msg host code
*
* Our errors returned by OUR driver, NOT SCSI message. Or'd with
* SCSI message passed back to driver <IF any>.
*/
/* host byte codes */
#define DID_OK 0x00 /* NO error */
#define DID_NO_CONNECT 0x01 /* Couldn't connect before timeout period */
#define DID_BUS_BUSY 0x02 /* BUS stayed busy through time out period */
......
......@@ -92,10 +92,8 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag)
*
* Notes:
* This should be turned into an inline function. Each scsi command
* has it's own timer, and as it is added to the queue, we set up the
* timer. When the command completes, we cancel the timer. Pretty
* simple, really, especially compared to the old way of handling this
* crap.
* has its own timer, and as it is added to the queue, we set up the
* timer. When the command completes, we cancel the timer.
**/
void scsi_add_timer(struct scsi_cmnd *scmd, int timeout,
void (*complete)(struct scsi_cmnd *))
......@@ -249,6 +247,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
{
if (!SCSI_SENSE_VALID(scmd))
return FAILED;
if (scmd->sense_buffer[2] & 0xe0)
return SUCCESS;
......@@ -1193,12 +1192,12 @@ void scsi_sleep(int timeout)
* Notes:
* This is *only* called when we are examining the status after sending
* out the actual data command. any commands that are queued for error
* recovery (i.e. test_unit_ready) do *not* come through here.
* recovery (e.g. test_unit_ready) do *not* come through here.
*
* When this routine returns failed, it means the error handler thread
* is woken. in cases where the error code indicates an error that
* is woken. In cases where the error code indicates an error that
* doesn't require the error handler read (i.e. we don't need to
* abort/reset), then this function should return SUCCESS.
* abort/reset), this function should return SUCCESS.
**/
int scsi_decide_disposition(struct scsi_cmnd *scmd)
{
......@@ -1214,11 +1213,11 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
__FUNCTION__));
return SUCCESS;
}
/*
* first check the host byte, to see if there is anything in there
* that would indicate what we need to do.
*/
switch (host_byte(scmd->result)) {
case DID_PASSTHROUGH:
/*
......@@ -1296,11 +1295,11 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
/*
* next, check the message byte.
*/
if (msg_byte(scmd->result) != COMMAND_COMPLETE) {
if (msg_byte(scmd->result) != COMMAND_COMPLETE)
return FAILED;
}
/*
* now, check the status byte to see if this indicates anything special.
* check the status byte to see if this indicates anything special.
*/
switch (status_byte(scmd->result)) {
case QUEUE_FULL:
......@@ -1321,10 +1320,11 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
return SUCCESS;
case CHECK_CONDITION:
rtn = scsi_check_sense(scmd);
if (rtn == NEEDS_RETRY) {
if (rtn == NEEDS_RETRY)
goto maybe_retry;
}
return rtn;
/* if rtn == FAILED, we have no sense information */
/* was: return rtn; */
return SUCCESS;
case CONDITION_GOOD:
case INTERMEDIATE_GOOD:
case INTERMEDIATE_C_GOOD:
......
......@@ -960,7 +960,6 @@ static void scsi_load_identifier(Scsi_Device *sdev, Scsi_Request *sreq)
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: host %d channel %d"
" id %d lun %d name/id: '%s'\n", sdev->host->host_no,
sdev->channel, sdev->id, sdev->lun, sdev->sdev_driverfs_dev.name));
return;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment