linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ide: Requeue request after DMA timeout
@ 2010-03-31  6:17 Herbert Xu
  2010-03-31  6:20 ` ide: Must hold queue lock when requeueing Herbert Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Herbert Xu @ 2010-03-31  6:17 UTC (permalink / raw)
  To: David S. Miller, Tejun Heo, linux-ide

Hi:

ide: Requeue request after DMA timeout

I noticed that my KVM virtual machines were experiencing IDE
issues resulting in processes stuck on waiting for buffers to
complete.

The root cause is of course race conditions in the ancient qemu
backend that I'm using.  However, the fact that the guest isn't
recovering is a bug.

I've tracked it down to the change made last year to dequeue
requests at the start rather than at the end in the IDE layer.

commit 8f6205cd572fece673da0255d74843680f67f879
Author: Tejun Heo <tj@kernel.org>
Date:   Fri May 8 11:53:59 2009 +0900

    ide: dequeue in-flight request

The problem is that the function ide_dma_timeout_retry does not
requeue the current request, causing one request to be lost for
each DMA timeout.

This patch fixes this by requeueing the request.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index ee58c88..62a257f 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -492,6 +492,7 @@ ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
 	if (rq) {
 		hwif->rq = NULL;
 		rq->errors = 0;
+		ide_requeue_request(drive, rq);
 	}
 	return ret;
 }
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index db96138..0a5f346 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -566,6 +566,16 @@ plug_device_2:
 		blk_plug_device(q);
 }
 
+void ide_requeue_request(ide_drive_t *drive, struct request *rq)
+{
+	struct request_queue *q = drive->queue;
+	unsigned long flags;
+
+	spin_lock_irqsave(q->queue_lock, flags);
+	blk_requeue_request(q, rq);
+	spin_unlock_irqrestore(q->queue_lock, flags);
+}
+
 static void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
 {
 	struct request_queue *q = drive->queue;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 97e6ab4..c369f27 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1169,6 +1169,7 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
 extern void ide_timer_expiry(unsigned long);
 extern irqreturn_t ide_intr(int irq, void *dev_id);
 extern void do_ide_request(struct request_queue *);
+extern void ide_requeue_request(ide_drive_t *drive, struct request *rq);
 
 void ide_init_disk(struct gendisk *, ide_drive_t *);
 

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2010-04-01  8:31 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31  6:17 ide: Requeue request after DMA timeout Herbert Xu
2010-03-31  6:20 ` ide: Must hold queue lock when requeueing Herbert Xu
2010-04-01  3:06   ` Tejun Heo
2010-04-01  6:11     ` v2: ide: Requeue request after DMA timeout Herbert Xu
2010-04-01  6:13       ` v2: ide: Must hold queue lock when requeueing Herbert Xu
2010-04-01  8:31         ` David Miller
2010-04-01  8:31       ` v2: ide: Requeue request after DMA timeout David Miller
2010-04-01  2:34 ` David Miller
2010-04-01  3:05   ` Tejun Heo
2010-04-01  3:04 ` Tejun Heo
2010-04-01  4:32   ` Herbert Xu
2010-04-01  4:56     ` Tejun Heo
2010-04-01  5:54       ` Herbert Xu
2010-04-01  6:25         ` Tejun Heo
2010-04-01  6:32           ` Herbert Xu
2010-04-01  6:37             ` Tejun Heo
2010-04-01  7:54               ` Herbert Xu
2010-04-01  8:26                 ` Tejun Heo
2010-04-01  8:27                   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).