patch-2.3.47 linux/drivers/scsi/scsi_obsolete.c

Next file: linux/drivers/scsi/scsi_scan.c
Previous file: linux/drivers/scsi/scsi_lib.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.46/linux/drivers/scsi/scsi_obsolete.c linux/drivers/scsi/scsi_obsolete.c
@@ -231,6 +231,8 @@
 	SCpnt->use_sg = 0;
 	SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]);
 	SCpnt->result = 0;
+	SCpnt->sc_data_direction = SCSI_DATA_READ;
+
         /*
          * Ugly, ugly.  The newer interfaces all assume that the lock
          * isn't held.  Mustn't disappoint, or we deadlock the system.
@@ -374,6 +376,7 @@
 	if (SCpnt->flags & WAS_SENSE) {
 		SCpnt->use_sg = SCpnt->old_use_sg;
 		SCpnt->cmd_len = SCpnt->old_cmd_len;
+		SCpnt->sc_data_direction = SCpnt->sc_old_data_direction;
 	}
 	switch (host_byte(result)) {
 	case DID_OK:
@@ -633,6 +636,7 @@
 			SCpnt->request_bufflen = SCpnt->bufflen;
 			SCpnt->use_sg = SCpnt->old_use_sg;
 			SCpnt->cmd_len = SCpnt->old_cmd_len;
+			SCpnt->sc_data_direction = SCpnt->sc_old_data_direction;
 			SCpnt->result = 0;
                         /*
                          * Ugly, ugly.  The newer interfaces all
@@ -649,6 +653,7 @@
 	}
 
 	if (status == CMD_FINISHED) {
+		Scsi_Request *SRpnt;
 #ifdef DEBUG
 		printk("Calling done function - at address %p\n", SCpnt->done);
 #endif
@@ -658,6 +663,7 @@
 		SCpnt->result = result | ((exit & 0xff) << 24);
 		SCpnt->use_sg = SCpnt->old_use_sg;
 		SCpnt->cmd_len = SCpnt->old_cmd_len;
+		SCpnt->sc_data_direction = SCpnt->sc_old_data_direction;
                 /*
                  * The upper layers assume the lock isn't held.  We mustn't
                  * disappoint them.  When the new error handling code is in
@@ -665,6 +671,16 @@
                  * it isn't an issue.
                  */
                 spin_unlock_irq(&io_request_lock);
+		SRpnt = SCpnt->sc_request;
+		if( SRpnt != NULL ) {
+			SRpnt->sr_result = SRpnt->sr_command->result;
+			if( SRpnt->sr_result != 0 ) {
+				memcpy(SRpnt->sr_sense_buffer,
+				       SRpnt->sr_command->sense_buffer,
+				       sizeof(SRpnt->sr_sense_buffer));
+			}
+		}
+
 		SCpnt->done(SCpnt);
                 spin_lock_irq(&io_request_lock);
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)