diff options
-rw-r--r-- | drivers/scsi/scsi_lib.c | 11 | ||||
-rw-r--r-- | include/scsi/scsi.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 10430d500792..393f9db8f41b 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -867,6 +867,17 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
867 | /* for passthrough error may be set */ | 867 | /* for passthrough error may be set */ |
868 | error = BLK_STS_OK; | 868 | error = BLK_STS_OK; |
869 | } | 869 | } |
870 | /* | ||
871 | * Another corner case: the SCSI status byte is non-zero but 'good'. | ||
872 | * Example: PRE-FETCH command returns SAM_STAT_CONDITION_MET when | ||
873 | * it is able to fit nominated LBs in its cache (and SAM_STAT_GOOD | ||
874 | * if it can't fit). Treat SAM_STAT_CONDITION_MET and the related | ||
875 | * intermediate statuses (both obsolete in SAM-4) as good. | ||
876 | */ | ||
877 | if (status_byte(result) && scsi_status_is_good(result)) { | ||
878 | result = 0; | ||
879 | error = BLK_STS_OK; | ||
880 | } | ||
870 | 881 | ||
871 | /* | 882 | /* |
872 | * special case: failed zero length commands always need to | 883 | * special case: failed zero length commands always need to |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index cb85eddb47ea..eb7853c1a23b 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -47,6 +47,8 @@ static inline int scsi_status_is_good(int status) | |||
47 | */ | 47 | */ |
48 | status &= 0xfe; | 48 | status &= 0xfe; |
49 | return ((status == SAM_STAT_GOOD) || | 49 | return ((status == SAM_STAT_GOOD) || |
50 | (status == SAM_STAT_CONDITION_MET) || | ||
51 | /* Next two "intermediate" statuses are obsolete in SAM-4 */ | ||
50 | (status == SAM_STAT_INTERMEDIATE) || | 52 | (status == SAM_STAT_INTERMEDIATE) || |
51 | (status == SAM_STAT_INTERMEDIATE_CONDITION_MET) || | 53 | (status == SAM_STAT_INTERMEDIATE_CONDITION_MET) || |
52 | /* FIXME: this is obsolete in SAM-3 */ | 54 | /* FIXME: this is obsolete in SAM-3 */ |