summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2004-10-24 09:31:25 +0000
committerScott Long <scottl@FreeBSD.org>2004-10-24 09:31:25 +0000
commit0e07fcb33baa179ca4746beb14c610bdca63c802 (patch)
treea14a2a6abd5b7bcf22499991655957ed6c1642ee
parent8972517206b28a9a3fba17160d17f26442f30a9d (diff)
downloadsrc-test2-0e07fcb33baa179ca4746beb14c610bdca63c802.tar.gz
src-test2-0e07fcb33baa179ca4746beb14c610bdca63c802.zip
MFC:
Do not retry on requests that has lost thier device during reinit. Should fix hangs on IBM's etc with the fake slave problem. Approved by: re
Notes
Notes: svn path=/releng/5.3/; revision=136869
-rw-r--r--sys/dev/ata/ata-all.c12
-rw-r--r--sys/dev/ata/ata-queue.c15
2 files changed, 9 insertions, 18 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index d546c588feb6..f2fccd7105a8 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -306,6 +306,12 @@ ata_reinit(struct ata_channel *ch)
}
}
+ ch->flags &= ~ATA_IMMEDIATE_MODE;
+ mtx_lock(&ch->state_mtx);
+ ch->state = ATA_IDLE;
+ mtx_unlock(&ch->state_mtx);
+ ch->locking(ch, ATA_LF_UNLOCK);
+
/* attach new devices */
if ((newdev = ~devices & ch->devices)) {
if ((newdev & (ATA_ATA_MASTER | ATA_ATAPI_MASTER)) &&
@@ -323,12 +329,6 @@ ata_reinit(struct ata_channel *ch)
if (bootverbose)
ata_printf(ch, -1, "device config done ..\n");
- ch->flags &= ~ATA_IMMEDIATE_MODE;
- mtx_lock(&ch->state_mtx);
- ch->state = ATA_IDLE;
- mtx_unlock(&ch->state_mtx);
- ch->locking(ch, ATA_LF_UNLOCK);
-
ata_start(ch);
return 0;
}
diff --git a/sys/dev/ata/ata-queue.c b/sys/dev/ata/ata-queue.c
index 32332726dcf0..d0544d07ea27 100644
--- a/sys/dev/ata/ata-queue.c
+++ b/sys/dev/ata/ata-queue.c
@@ -182,15 +182,13 @@ ata_start(struct ata_channel *ch)
/* check for the right state */
mtx_lock(&ch->state_mtx);
if (ch->state == ATA_IDLE) {
+ ATA_DEBUG_RQ(request, "starting");
TAILQ_REMOVE(&ch->ata_queue, request, chain);
ch->running = request;
-
- ATA_DEBUG_RQ(request, "starting");
-
+ ch->state = ATA_ACTIVE;
if (!dumping)
callout_reset(&request->callout, request->timeout * hz,
(timeout_t*)ata_timeout, request);
-
if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) {
ch->running = NULL;
ch->state = ATA_IDLE;
@@ -200,8 +198,6 @@ ata_start(struct ata_channel *ch)
ata_finish(request);
return;
}
- else
- ch->state = ATA_ACTIVE;
}
mtx_unlock(&ch->state_mtx);
}
@@ -242,14 +238,9 @@ ata_completed(void *context, int dummy)
/* if we had a timeout, reinit channel and deal with the falldown */
if (request->flags & ATA_R_TIMEOUT) {
- int error = ata_reinit(ch);
- /* if our device disappeared return as cleanup was done already */
- if (!request->device->param)
- return;
-
/* if reinit succeeded and retries still permit, reinject request */
- if (!error && request->retries-- > 0) {
+ if (ata_reinit(ch) && request->retries-- > 0 && request->device->param){
request->flags &= ~(ATA_R_TIMEOUT | ATA_R_DEBUG);
request->flags |= (ATA_R_IMMEDIATE | ATA_R_REQUEUE);
ATA_DEBUG_RQ(request, "completed reinject");