For some reason, the error recovery code issues a test unit ready
with a 256 byte buffer.  This wouldn't be so bad (just a useless allocation)
except for the fact that the command correctly states that no data will
be transferred.  This confuses the logic of some drivers which assume that
a data transfer will occur if a buffer is provided.  In the case of the
new aic7xxx driver, it causes a panic when the driver attempts to load
the buffer with an invalid data direction.  I may change the aic7xxx
driver to use the data direction as the real test of whether a data
transfer will occur, but either what this is confusing.
 
--
Justin

diff -u -r -N linux-2.4.1.virgin/drivers/scsi/scsi_error.c 
linux-2.4.1/drivers/scsi/scsi_error.c
--- linux-2.4.1.virgin/drivers/scsi/scsi_error.c        Wed Nov  8 18:09:50 2000
+++ linux-2.4.1/drivers/scsi/scsi_error.c       Fri Feb  9 23:01:01 2001
@@ -492,31 +492,20 @@
 {
        static unsigned char tur_command[6] =
        {TEST_UNIT_READY, 0, 0, 0, 0, 0};
-       unsigned char scsi_result0[256], *scsi_result = NULL;
 
        memcpy((void *) SCpnt->cmnd, (void *) tur_command,
               sizeof(tur_command));
 
        SCpnt->cmnd[1] = SCpnt->lun << 5;
 
-       scsi_result = (!SCpnt->host->hostt->unchecked_isa_dma)
-           ? &scsi_result0[0] : kmalloc(512, GFP_ATOMIC | GFP_DMA);
-
-       if (scsi_result == NULL) {
-               printk("cannot allocate scsi_result in scsi_test_unit_ready.\n");
-               return FAILED;
-       }
        /*
-        * Zero the sense buffer.  Some host adapters automatically always request
-        * sense, so it is not a good idea that SCpnt->request_buffer and
-        * SCpnt->sense_buffer point to the same address (DB).
-        * 0 is not a valid sense code. 
+        * Zero the sense buffer.  The SCSI spec mandates that any
+        * untransferred sense data should be interpreted as being zero.
         */
        memset((void *) SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer));
-       memset((void *) scsi_result, 0, 256);
 
-       SCpnt->request_buffer = scsi_result;
-       SCpnt->request_bufflen = 256;
+       SCpnt->request_buffer = NULL;
+       SCpnt->request_bufflen = 0;
        SCpnt->use_sg = 0;
        SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]);
        SCpnt->underflow = 0;
@@ -524,15 +513,6 @@
 
        scsi_send_eh_cmnd(SCpnt, SENSE_TIMEOUT);
 
-       /* Last chance to have valid sense data */
-       if (!scsi_sense_valid(SCpnt))
-               memcpy((void *) SCpnt->sense_buffer,
-                      SCpnt->request_buffer,
-                      sizeof(SCpnt->sense_buffer));
-
-       if (scsi_result != &scsi_result0[0] && scsi_result != NULL)
-               kfree(scsi_result);
-
        /*
         * When we eventually call scsi_finish, we really wish to complete
         * the original request, so let's restore the original data. (DB)
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to