diff options
author | Tejun Heo <tj@kernel.org> | 2008-07-31 03:08:02 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-08-22 02:19:41 -0400 |
commit | 5dbfc9cb59d4ad75199949d7dd8a8c6d7bc518df (patch) | |
tree | b0574dea3b5bfcf9418abb1a08bfe24a77fbcd37 /drivers/ata/libata-eh.c | |
parent | a674050e068a2919908730279f0b731ae6d2e005 (diff) |
libata: always do follow-up SRST if hardreset returned -EAGAIN
As an optimization, follow-up SRST used to be skipped if
classification wasn't requested even when hardreset requested it via
-EAGAIN. However, some hardresets can't wait for device readiness and
skipping SRST can cause timeout or other failures during revalidation.
Always perform follow-up SRST if hardreset returns -EAGAIN. This
makes reset paths more predictable and thus less error-prone.
While at it, move hardreset error checking such that it's done right
after hardreset is finished. This simplifies followup SRST condition
check a bit and makes the reset path easier to modify.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c98909ba0b1c..d4dad47b8f17 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2171,18 +2171,12 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2171 | } | 2171 | } |
2172 | 2172 | ||
2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, | 2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, |
2174 | int rc, int classify, | 2174 | int rc, const unsigned int *classes) |
2175 | const unsigned int *classes) | ||
2176 | { | 2175 | { |
2177 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) | 2176 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) |
2178 | return 0; | 2177 | return 0; |
2179 | if (rc == -EAGAIN) { | 2178 | if (rc == -EAGAIN) |
2180 | if (classify) | 2179 | return 1; |
2181 | return 1; | ||
2182 | rc = 0; | ||
2183 | } | ||
2184 | if (rc != 0) | ||
2185 | return 0; | ||
2186 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) | 2180 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) |
2187 | return 1; | 2181 | return 1; |
2188 | return 0; | 2182 | return 0; |
@@ -2309,9 +2303,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2309 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2303 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
2310 | 2304 | ||
2311 | rc = ata_do_reset(link, reset, classes, deadline); | 2305 | rc = ata_do_reset(link, reset, classes, deadline); |
2306 | if (rc && rc != -EAGAIN) | ||
2307 | goto fail; | ||
2312 | 2308 | ||
2313 | if (reset == hardreset && | 2309 | if (reset == hardreset && |
2314 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { | 2310 | ata_eh_followup_srst_needed(link, rc, classes)) { |
2315 | /* okay, let's do follow-up softreset */ | 2311 | /* okay, let's do follow-up softreset */ |
2316 | reset = softreset; | 2312 | reset = softreset; |
2317 | 2313 | ||
@@ -2326,10 +2322,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2326 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2327 | rc = ata_do_reset(link, reset, classes, deadline); | 2323 | rc = ata_do_reset(link, reset, classes, deadline); |
2328 | } | 2324 | } |
2329 | |||
2330 | /* -EAGAIN can happen if we skipped followup SRST */ | ||
2331 | if (rc && rc != -EAGAIN) | ||
2332 | goto fail; | ||
2333 | } else { | 2325 | } else { |
2334 | if (verbose) | 2326 | if (verbose) |
2335 | ata_link_printk(link, KERN_INFO, "no reset method " | 2327 | ata_link_printk(link, KERN_INFO, "no reset method " |