浏览代码

[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>
Martin K. Petersen 16 年之前
父节点
当前提交
3e695f89c5
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      drivers/scsi/scsi_lib.c

+ 8 - 1
drivers/scsi/scsi_lib.c

@@ -980,6 +980,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 		return;
 		return;
 	this_count = blk_rq_bytes(req);
 	this_count = blk_rq_bytes(req);
 
 
+	error = -EIO;
+
 	if (host_byte(result) == DID_RESET) {
 	if (host_byte(result) == DID_RESET) {
 		/* Third party bus reset or reset for error recovery
 		/* Third party bus reset or reset for error recovery
 		 * reasons.  Just retry the command and see what
 		 * reasons.  Just retry the command and see what
@@ -1021,13 +1023,18 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 				/* This will issue a new 6-byte command. */
 				/* This will issue a new 6-byte command. */
 				cmd->device->use_10_for_rw = 0;
 				cmd->device->use_10_for_rw = 0;
 				action = ACTION_REPREP;
 				action = ACTION_REPREP;
+			} else if (sshdr.asc == 0x10) /* DIX */ {
+				description = "Host Data Integrity Failure";
+				action = ACTION_FAIL;
+				error = -EILSEQ;
 			} else
 			} else
 				action = ACTION_FAIL;
 				action = ACTION_FAIL;
 			break;
 			break;
 		case ABORTED_COMMAND:
 		case ABORTED_COMMAND:
 			if (sshdr.asc == 0x10) { /* DIF */
 			if (sshdr.asc == 0x10) { /* DIF */
+				description = "Target Data Integrity Failure";
 				action = ACTION_FAIL;
 				action = ACTION_FAIL;
-				description = "Data Integrity Failure";
+				error = -EILSEQ;
 			} else
 			} else
 				action = ACTION_RETRY;
 				action = ACTION_RETRY;
 			break;
 			break;