[5142] in linux-scsi channel archive
Re: Scsi tape - returns ENXIO after an error (aha1542 + others)[PATCH]
daemon@ATHENA.MIT.EDU (Kai Makisara)
Sun Nov 15 16:41:53 1998
Date: Sun, 15 Nov 1998 21:34:56 +0200 (EET)
From: Kai Makisara <makisara@metla.fi>
Reply-To: Kai.Makisara@metla.fi
To: Richard Fish <rjf@estinc.com>
cc: linux-scsi@vger.rutgers.edu
In-Reply-To: <Pine.OSF.4.05.9811151002520.24135-100000@abies.metla.fi>
On Sun, 15 Nov 1998, Kai M{kisara wrote:
...
> I will try to find some time to read the code tonight to see if this is
OK. I have done some studying. I have also managed to get one computer
running with a tape, aha1542, and 2.1.128. The patch resulting from this
study is at the end of the message.
The following discussion applies to the new SCSI code.
When a SCSI command is finished, the function scsi_done() in scsi.c is
called. It queues the result to be handled by the bottom half. The bottom
half handler uses the function scsi_decide_disposition() (in scsi_error.c)
to decide what to do. If it returns SUCCESS, the result is returned to the
upper level. If it returns NEEDS_RETRY, the command is retried. If it
returns ADD_TO_MLQUEUE, the command is queued again. Other codes
(including SOFT_ERROR !) result in waking up the error handler thread.
scsi_decide_disposition() uses scsi_check_sense() (in scsi_error.c to
decide what to do. It seems to me that scsi_check_sense() in should only
return either SUCCESS or NEEDS_RETRY, except from the first test
(!scsi_sense_valid(SCpnt)). When valid sense data is returned, the host
adapter is working correctly and there is no reason to do host-specific
error handling.
The first test returns FAILED if the sense data is not valid. If the
adapter has an error handling function, it is used. Otherwise the function
scsi_unjam_host() is called. It first tries to get the sense data by doing
explicit REQUEST SENSE. If this succeeds, the sense data is processed by
scsi_decide_disposition() and the result is returned to the upper level.
This is correct (aha1542 does REQUEST SENSE automatically and so this is
not used). If requesting sense data fails, then follow aborting the
command, etc. We don't want to get into this in normal tape operation (for
instance, at FM).
Kai
----------------------------8<-----------------------------------------
--- /source/linux/drivers/scsi/scsi_error.c Sat Aug 8 12:12:35 1998
+++ linux/drivers/scsi/scsi_error.c Sun Nov 15 20:32:57 1998
@@ -1183,14 +1183,14 @@
}
if (SCpnt->sense_buffer[2] & 0xe0)
- return FAILED;
+ return SUCCESS;
switch (SCpnt->sense_buffer[2] & 0xf)
{
case NO_SENSE:
return SUCCESS;
case RECOVERED_ERROR:
- return SOFT_ERROR;
+ return /* SOFT_ERROR */ SUCCESS;
case ABORTED_COMMAND:
return NEEDS_RETRY;
@@ -1213,18 +1213,17 @@
case COPY_ABORTED:
case VOLUME_OVERFLOW:
case MISCOMPARE:
+ return SUCCESS;
case MEDIUM_ERROR:
- return FAILED;
+ return NEEDS_RETRY;
case ILLEGAL_REQUEST:
- return SUCCESS;
-
case BLANK_CHECK:
case DATA_PROTECT:
case HARDWARE_ERROR:
default:
- return FAILED;
+ return SUCCESS;
}
}
----------------------------8<-----------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu