]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR
authorMike Snitzer <snitzer@redhat.com>
Mon, 13 Feb 2012 23:35:11 +0000 (18:35 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Sun, 19 Feb 2012 15:39:59 +0000 (09:39 -0600)
Permanent target failures are non-retryable and should be classified as
TARGET_ERROR; otherwise dm-multipath will retry an IO request that will
always fail at the target.

A SCSI command that fails with ILLEGAL_REQUEST sense and Additional
sense 0x20, 0x21, 0x24 or 0x26 represents a permanent TARGET_ERROR.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_error.c

index 6ae3b5dbd3796d645a8c8f0df205529484974f71..f66e90db3bee39bca8cfd7870e8d9c74475fba3b 100644 (file)
@@ -366,6 +366,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
                        return TARGET_ERROR;
 
        case ILLEGAL_REQUEST:
+               if (sshdr.asc == 0x20 || /* Invalid command operation code */
+                   sshdr.asc == 0x21 || /* Logical block address out of range */
+                   sshdr.asc == 0x24 || /* Invalid field in cdb */
+                   sshdr.asc == 0x26) { /* Parameter value invalid */
+                       return TARGET_ERROR;
+               }
+               return SUCCESS;
+
        default:
                return SUCCESS;
        }