[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-24
Subject:    [PATCH] Handle SCSI recovered errors
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2003-02-26 20:18:32
[Download RAW message or body]

ChangeSet 1.989.6.4, 2003/02/26 17:18:32-03:00, garloff@suse.de

	[PATCH] Handle SCSI recovered errors
	
	Hi,
	
	When a command returns CHECK_CONDITION and the sense information is
	retrieved, the scsi block drivers (sd, sr) do not handle the sense key
	correctly.
	The valid bit only tells about validity of the information field (bytes 3
	-- 6) of the fixed sense buffer. If it's not set, the sense key and ASC/ASCQ
	are still valid. [spc3r10, 7.24.2.3]
	But sd/sr consider the whole sense key invalid then.
	This hits us for a RECOVERED_ERROR sense key that should be reported but
	considered a success. Currently (2.4.20) sd/sr erroneously do consider it
	an error, if the valid bit is unset.
	
	Patch against 2.4.20 is attached.
	I did not look into 2.5.59, but I guess it has the same problem.
	
	Note that the change to scsi_lib is not strictly required, as with the fixes
	to sr and sd, one should not get there for recovered errors any more. On the
	other hand, it's good to have it there for correctness.


# This patch includes the following deltas:
#	           ChangeSet	1.989.6.3 -> 1.989.6.4
#	   drivers/scsi/sr.c	1.14    -> 1.15   
#	drivers/scsi/scsi_lib.c	1.15    -> 1.16   
#	   drivers/scsi/sd.c	1.25    -> 1.26   
#

 scsi_lib.c |    2 ++
 sd.c       |    4 +++-
 sr.c       |    4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)


diff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c	Wed Feb 26 13:32:33 2003
+++ b/drivers/scsi/scsi_lib.c	Wed Feb 26 13:32:33 2003
@@ -695,6 +695,8 @@
 		 */
 
 		switch (SCpnt->sense_buffer[2]) {
+		case RECOVERED_ERROR: /* Added, KG, 2003-01-20 */
+			return;
 		case ILLEGAL_REQUEST:
 			if (SCpnt->device->ten && SCSI_RETRY_10(SCpnt->cmnd[0])) {
 				SCpnt->device->ten = 0;
diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c	Wed Feb 26 13:32:33 2003
+++ b/drivers/scsi/sd.c	Wed Feb 26 13:32:33 2003
@@ -621,9 +621,11 @@
 
 	/* An error occurred */
 	if (driver_byte(result) != 0 && 	/* An error occured */
-	    SCpnt->sense_buffer[0] == 0xF0) {	/* Sense data is valid */
+	    (SCpnt->sense_buffer[0] & 0x7f) == 0x70) {	/* Sense data is valid */
 		switch (SCpnt->sense_buffer[2]) {
 		case MEDIUM_ERROR:
+			if (!(SCpnt->sense_buffer[0] & 0x80))
+				break;
 			error_sector = (SCpnt->sense_buffer[3] << 24) |
 			(SCpnt->sense_buffer[4] << 16) |
 			(SCpnt->sense_buffer[5] << 8) |
diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
--- a/drivers/scsi/sr.c	Wed Feb 26 13:32:33 2003
+++ b/drivers/scsi/sr.c	Wed Feb 26 13:32:33 2003
@@ -211,11 +211,13 @@
 
 
 	if (driver_byte(result) != 0 &&		/* An error occurred */
-	    SCpnt->sense_buffer[0] == 0xF0) {	/* Sense data is valid */
+	    (SCpnt->sense_buffer[0] & 0x7f) == 0x70) {	/* Sense data is valid */
 		switch (SCpnt->sense_buffer[2]) {
 		case MEDIUM_ERROR:
 		case VOLUME_OVERFLOW:
 		case ILLEGAL_REQUEST:
+			if (!(SCpnt->sense_buffer[0] & 0x80))
+				break;
 			error_sector = (SCpnt->sense_buffer[3] << 24) |
 			(SCpnt->sense_buffer[4] << 16) |
 			(SCpnt->sense_buffer[5] << 8) |
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic