diff options
author | Hannes Reinecke <hare@suse.de> | 2016-04-04 05:44:01 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-04-04 12:07:41 -0400 |
commit | 3852e37382664a06cd006bb389a8223e32cedf45 (patch) | |
tree | bcdb3a96ee06503433225cde2d3d8dd84d60213a /drivers/ata/libata-eh.c | |
parent | b525e7731b90ebc7a70a095fc5d5363408b94274 (diff) |
libata: evaluate SCSI sense code
Whenever a sense code is set it would need to be evaluated to
update the error mask.
tj: Cosmetic formatting updates.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index e4e0e2e80c20..e37258b78e01 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1920,20 +1920,31 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
1920 | tmp = atapi_eh_request_sense(qc->dev, | 1920 | tmp = atapi_eh_request_sense(qc->dev, |
1921 | qc->scsicmd->sense_buffer, | 1921 | qc->scsicmd->sense_buffer, |
1922 | qc->result_tf.feature >> 4); | 1922 | qc->result_tf.feature >> 4); |
1923 | if (!tmp) { | 1923 | if (!tmp) |
1924 | /* ATA_QCFLAG_SENSE_VALID is used to | ||
1925 | * tell atapi_qc_complete() that sense | ||
1926 | * data is already valid. | ||
1927 | * | ||
1928 | * TODO: interpret sense data and set | ||
1929 | * appropriate err_mask. | ||
1930 | */ | ||
1931 | qc->flags |= ATA_QCFLAG_SENSE_VALID; | 1924 | qc->flags |= ATA_QCFLAG_SENSE_VALID; |
1932 | } else | 1925 | else |
1933 | qc->err_mask |= tmp; | 1926 | qc->err_mask |= tmp; |
1934 | } | 1927 | } |
1935 | } | 1928 | } |
1936 | 1929 | ||
1930 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { | ||
1931 | int ret = scsi_check_sense(qc->scsicmd); | ||
1932 | /* | ||
1933 | * SUCCESS here means that the sense code could | ||
1934 | * evaluated and should be passed to the upper layers | ||
1935 | * for correct evaluation. | ||
1936 | * FAILED means the sense code could not interpreted | ||
1937 | * and the device would need to be reset. | ||
1938 | * NEEDS_RETRY and ADD_TO_MLQUEUE means that the | ||
1939 | * command would need to be retried. | ||
1940 | */ | ||
1941 | if (ret == NEEDS_RETRY || ret == ADD_TO_MLQUEUE) { | ||
1942 | qc->flags |= ATA_QCFLAG_RETRY; | ||
1943 | qc->err_mask |= AC_ERR_OTHER; | ||
1944 | } else if (ret != SUCCESS) { | ||
1945 | qc->err_mask |= AC_ERR_HSM; | ||
1946 | } | ||
1947 | } | ||
1937 | if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) | 1948 | if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) |
1938 | action |= ATA_EH_RESET; | 1949 | action |= ATA_EH_RESET; |
1939 | 1950 | ||