Commit 3e695f89c5debb735e4ff051e9e58d8fb4e95110

Authored by Martin K. Petersen
Committed by James Bottomley
1 parent 4f5299ac4e

[SCSI] Fix error handling for DIF/DIX

patch

commit b60af5b0adf0da24c673598c8d3fb4d4189a15ce
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Mon Nov 3 15:56:47 2008 -0500

    [SCSI] simplify scsi_io_completion()

broke DIX error handling.  Also, we are now using EILSEQ to indicate
integrity errors to the upper layers (as opposed to regular EIO
failures).  This allows filesystems to inspect buffers and decide
whether to retry the I/O.  Update scsi_io_completion() accordingly.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Showing 1 changed file with 8 additions and 1 deletions Side-by-side Diff

drivers/scsi/scsi_lib.c
... ... @@ -980,6 +980,8 @@
980 980 return;
981 981 this_count = blk_rq_bytes(req);
982 982  
  983 + error = -EIO;
  984 +
983 985 if (host_byte(result) == DID_RESET) {
984 986 /* Third party bus reset or reset for error recovery
985 987 * reasons. Just retry the command and see what
986 988  
987 989  
... ... @@ -1021,13 +1023,18 @@
1021 1023 /* This will issue a new 6-byte command. */
1022 1024 cmd->device->use_10_for_rw = 0;
1023 1025 action = ACTION_REPREP;
  1026 + } else if (sshdr.asc == 0x10) /* DIX */ {
  1027 + description = "Host Data Integrity Failure";
  1028 + action = ACTION_FAIL;
  1029 + error = -EILSEQ;
1024 1030 } else
1025 1031 action = ACTION_FAIL;
1026 1032 break;
1027 1033 case ABORTED_COMMAND:
1028 1034 if (sshdr.asc == 0x10) { /* DIF */
  1035 + description = "Target Data Integrity Failure";
1029 1036 action = ACTION_FAIL;
1030   - description = "Data Integrity Failure";
  1037 + error = -EILSEQ;
1031 1038 } else
1032 1039 action = ACTION_RETRY;
1033 1040 break;