]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
libata: Fix command retry decision
authorDamien Le Moal <damien.lemoal@wdc.com>
Wed, 9 May 2018 00:28:12 +0000 (09:28 +0900)
committerTejun Heo <tj@kernel.org>
Thu, 10 May 2018 18:43:20 +0000 (11:43 -0700)
For failed commands with valid sense data (e.g. NCQ commands),
scsi_check_sense() is used in ata_analyze_tf() to determine if the
command can be retried. In such case, rely on this decision and ignore
the command error mask based decision done in ata_worth_retry().

This fixes useless retries of commands such as unaligned writes on zoned
disks (TYPE_ZAC).

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libata-eh.c

index b933357edc22ce1f2588db562946bbe5da86454c..1035de1e5120e6a2060334df7df70097a18d7032 100644 (file)
@@ -2237,12 +2237,16 @@ static void ata_eh_link_autopsy(struct ata_link *link)
                if (qc->err_mask & ~AC_ERR_OTHER)
                        qc->err_mask &= ~AC_ERR_OTHER;
 
-               /* SENSE_VALID trumps dev/unknown error and revalidation */
+               /*
+                * SENSE_VALID trumps dev/unknown error and revalidation. Upper
+                * layers will determine whether the command is worth retrying
+                * based on the sense data and device class/type. Otherwise,
+                * determine directly if the command is worth retrying using its
+                * error mask and flags.
+                */
                if (qc->flags & ATA_QCFLAG_SENSE_VALID)
                        qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
-
-               /* determine whether the command is worth retrying */
-               if (ata_eh_worth_retry(qc))
+               else if (ata_eh_worth_retry(qc))
                        qc->flags |= ATA_QCFLAG_RETRY;
 
                /* accumulate error info */