提交 f4abab3f 编写于 作者: B Bart Van Assche 提交者: Martin K. Petersen

scsi: core: Make scsi_result_to_blk_status() recognize CONDITION MET

Ensure that CONDITION MET and other non-zero status values that indicate
success are translated into BLK_STS_OK.
Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Lee Duncan <lduncan@suse.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NHannes Reinecke <hare@suse.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 a77b32d8
...@@ -733,6 +733,15 @@ static bool scsi_end_request(struct request *req, blk_status_t error, ...@@ -733,6 +733,15 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
{ {
switch (host_byte(result)) { switch (host_byte(result)) {
case DID_OK:
/*
* Also check the other bytes than the status byte in result
* to handle the case when a SCSI LLD sets result to
* DRIVER_SENSE << 24 without setting SAM_STAT_CHECK_CONDITION.
*/
if (scsi_status_is_good(result) && (result & ~0xff) == 0)
return BLK_STS_OK;
return BLK_STS_IOERR;
case DID_TRANSPORT_FAILFAST: case DID_TRANSPORT_FAILFAST:
return BLK_STS_TRANSPORT; return BLK_STS_TRANSPORT;
case DID_TARGET_FAILURE: case DID_TARGET_FAILURE:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册