Skip to content

Commit f90f082

Browse files
htejunJeff Garzik
authored and
Jeff Garzik
committed
libata: stop being overjealous about non-IO commands
libata EH always revalidated device and retried failed command after error except for ATAPI CCs. This is unnecessary and hinders with users issuing direct commands. This patch makes the following changes. * Make sata_sil24 not request ATA_EH_REVALIDATE on device errors. sil24 is the only driver which does this. All others let libata EH core code decide. * Don't request revalidation after device error of non-IO command. Revalidation doesn't really help anybody. As ATA_EH_REVALIDATE isn't set by default, there's no reason to clear it after sense data is read. Kill ATA_EH_REVALIDATE clearing code while at it. * Don't retry non-IO command after device error. Device has rejected the command. There's no point in retrying. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
1 parent b666da3 commit f90f082

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

drivers/ata/libata-eh.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -1800,10 +1800,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
18001800
qc->err_mask &= ~AC_ERR_OTHER;
18011801

18021802
/* SENSE_VALID trumps dev/unknown error and revalidation */
1803-
if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
1803+
if (qc->flags & ATA_QCFLAG_SENSE_VALID)
18041804
qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
1805-
ehc->i.action &= ~ATA_EH_REVALIDATE;
1806-
}
18071805

18081806
/* accumulate error info */
18091807
ehc->i.dev = qc->dev;
@@ -1816,7 +1814,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
18161814
if (ap->pflags & ATA_PFLAG_FROZEN ||
18171815
all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT))
18181816
ehc->i.action |= ATA_EH_SOFTRESET;
1819-
else if (all_err_mask)
1817+
else if ((is_io && all_err_mask) ||
1818+
(!is_io && (all_err_mask & ~AC_ERR_DEV)))
18201819
ehc->i.action |= ATA_EH_REVALIDATE;
18211820

18221821
/* if we have offending qcs and the associated failed device */
@@ -2697,8 +2696,15 @@ void ata_eh_finish(struct ata_port *ap)
26972696
/* FIXME: Once EH migration is complete,
26982697
* generate sense data in this function,
26992698
* considering both err_mask and tf.
2699+
*
2700+
* There's no point in retrying invalid
2701+
* (detected by libata) and non-IO device
2702+
* errors (rejected by device). Finish them
2703+
* immediately.
27002704
*/
2701-
if (qc->err_mask & AC_ERR_INVALID)
2705+
if ((qc->err_mask & AC_ERR_INVALID) ||
2706+
(!(qc->flags & ATA_QCFLAG_IO) &&
2707+
qc->err_mask == AC_ERR_DEV))
27022708
ata_eh_qc_complete(qc);
27032709
else
27042710
ata_eh_qc_retry(qc);

drivers/ata/sata_sil24.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,11 @@ static struct sil24_cerr_info {
265265
unsigned int err_mask, action;
266266
const char *desc;
267267
} sil24_cerr_db[] = {
268-
[0] = { AC_ERR_DEV, ATA_EH_REVALIDATE,
268+
[0] = { AC_ERR_DEV, 0,
269269
"device error" },
270-
[PORT_CERR_DEV] = { AC_ERR_DEV, ATA_EH_REVALIDATE,
270+
[PORT_CERR_DEV] = { AC_ERR_DEV, 0,
271271
"device error via D2H FIS" },
272-
[PORT_CERR_SDB] = { AC_ERR_DEV, ATA_EH_REVALIDATE,
272+
[PORT_CERR_SDB] = { AC_ERR_DEV, 0,
273273
"device error via SDB FIS" },
274274
[PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET,
275275
"error in data FIS" },

0 commit comments

Comments
 (0)