提交 87f14e65 编写于 作者: H Hannes Reinecke 提交者: James Bottomley

[SCSI] Set hostbyte status in scsi_check_sense()

We should be modifying the host_byte status in scsi_check_sense()
directly; this saves us to introduce a special return code for
each and every condition.
Signed-off-by: NHannes Reinecke <hare@suse.de>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 0f7f6234
...@@ -228,7 +228,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, ...@@ -228,7 +228,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost,
* @scmd: Cmd to have sense checked. * @scmd: Cmd to have sense checked.
* *
* Return value: * Return value:
* SUCCESS or FAILED or NEEDS_RETRY or TARGET_ERROR * SUCCESS or FAILED or NEEDS_RETRY or ADD_TO_MLQUEUE
* *
* Notes: * Notes:
* When a deferred error is detected the current command has * When a deferred error is detected the current command has
...@@ -359,13 +359,15 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) ...@@ -359,13 +359,15 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
case MISCOMPARE: case MISCOMPARE:
case BLANK_CHECK: case BLANK_CHECK:
case DATA_PROTECT: case DATA_PROTECT:
return TARGET_ERROR; set_host_byte(scmd, DID_TARGET_FAILURE);
return SUCCESS;
case MEDIUM_ERROR: case MEDIUM_ERROR:
if (sshdr.asc == 0x11 || /* UNRECOVERED READ ERR */ if (sshdr.asc == 0x11 || /* UNRECOVERED READ ERR */
sshdr.asc == 0x13 || /* AMNF DATA FIELD */ sshdr.asc == 0x13 || /* AMNF DATA FIELD */
sshdr.asc == 0x14) { /* RECORD NOT FOUND */ sshdr.asc == 0x14) { /* RECORD NOT FOUND */
return TARGET_ERROR; set_host_byte(scmd, DID_TARGET_FAILURE);
return SUCCESS;
} }
return NEEDS_RETRY; return NEEDS_RETRY;
...@@ -373,14 +375,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) ...@@ -373,14 +375,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
if (scmd->device->retry_hwerror) if (scmd->device->retry_hwerror)
return ADD_TO_MLQUEUE; return ADD_TO_MLQUEUE;
else else
return TARGET_ERROR; set_host_byte(scmd, DID_TARGET_FAILURE);
case ILLEGAL_REQUEST: case ILLEGAL_REQUEST:
if (sshdr.asc == 0x20 || /* Invalid command operation code */ if (sshdr.asc == 0x20 || /* Invalid command operation code */
sshdr.asc == 0x21 || /* Logical block address out of range */ sshdr.asc == 0x21 || /* Logical block address out of range */
sshdr.asc == 0x24 || /* Invalid field in cdb */ sshdr.asc == 0x24 || /* Invalid field in cdb */
sshdr.asc == 0x26) { /* Parameter value invalid */ sshdr.asc == 0x26) { /* Parameter value invalid */
return TARGET_ERROR; set_host_byte(scmd, DID_TARGET_FAILURE);
} }
return SUCCESS; return SUCCESS;
...@@ -843,7 +845,6 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, ...@@ -843,7 +845,6 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
case SUCCESS: case SUCCESS:
case NEEDS_RETRY: case NEEDS_RETRY:
case FAILED: case FAILED:
case TARGET_ERROR:
break; break;
case ADD_TO_MLQUEUE: case ADD_TO_MLQUEUE:
rtn = NEEDS_RETRY; rtn = NEEDS_RETRY;
...@@ -1577,14 +1578,6 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) ...@@ -1577,14 +1578,6 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
rtn = scsi_check_sense(scmd); rtn = scsi_check_sense(scmd);
if (rtn == NEEDS_RETRY) if (rtn == NEEDS_RETRY)
goto maybe_retry; goto maybe_retry;
else if (rtn == TARGET_ERROR) {
/*
* Need to modify host byte to signal a
* permanent target failure
*/
set_host_byte(scmd, DID_TARGET_FAILURE);
rtn = SUCCESS;
}
/* if rtn == FAILED, we have no sense information; /* if rtn == FAILED, we have no sense information;
* returning FAILED will wake the error handler thread * returning FAILED will wake the error handler thread
* to collect the sense and redo the decide * to collect the sense and redo the decide
......
...@@ -486,7 +486,6 @@ static inline int scsi_is_wlun(unsigned int lun) ...@@ -486,7 +486,6 @@ static inline int scsi_is_wlun(unsigned int lun)
#define TIMEOUT_ERROR 0x2007 #define TIMEOUT_ERROR 0x2007
#define SCSI_RETURN_NOT_HANDLED 0x2008 #define SCSI_RETURN_NOT_HANDLED 0x2008
#define FAST_IO_FAIL 0x2009 #define FAST_IO_FAIL 0x2009
#define TARGET_ERROR 0x200A
/* /*
* Midlevel queue return values. * Midlevel queue return values.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册