On 4/4/2016 12:44 PM, Hannes Reinecke wrote:

Whenever a sense code is set it would need to be evaluated to
update the error mask.

Signed-off-by: Hannes Reinecke <h...@suse.de>
---
  drivers/ata/libata-eh.c   | 28 +++++++++++++++++++---------
  drivers/scsi/scsi_error.c |  3 ++-
  include/scsi/scsi_eh.h    |  1 +
  3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d33e7b8..99bb9f9 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1919,20 +1919,30 @@ static unsigned int ata_eh_analyze_tf(struct 
ata_queued_cmd *qc,
[...]

+       if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
+               int ret = scsi_check_sense(qc->scsicmd);
+               /*
+                * SUCCESS here means that the sense code could

   Could be?

+                * evaluated and should be passed to the upper layers
+                * for correct evaluation.
+                * FAILED means the sense code could not interpreted

   Could not be?

+                * and the device would need to be reset.
+                * NEEDS_RETRY and ADD_TO_MLQUEUE means that the
+                * command would need to be retried.
+                */
+               if (ret == NEEDS_RETRY || ret == ADD_TO_MLQUEUE) {
+                       qc->flags |= ATA_QCFLAG_RETRY;
+                       qc->err_mask |= AC_ERR_OTHER;
+               } else if (ret != SUCCESS)
+                       qc->err_mask |= AC_ERR_HSM;

   This is asking to be a *switch* statement instead.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to