* [Qemu-devel] [PATCH] ide: Fix ide_dma_cancel
@ 2010-05-05 9:54 Kevin Wolf
2010-05-05 18:48 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2010-05-05 9:54 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
When cancelling a request, bdrv_aio_cancel may decide that it waits for
completion of a request rather than for cancellation. IDE therefore can't
abandon its DMA status before calling bdrv_aio_cancel; otherwise the callback
of a completed request would use invalid data.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/ide/core.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0757528..3cd55e3 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2838,10 +2838,6 @@ static void ide_dma_restart(IDEState *s, int is_read)
void ide_dma_cancel(BMDMAState *bm)
{
if (bm->status & BM_STATUS_DMAING) {
- bm->status &= ~BM_STATUS_DMAING;
- /* cancel DMA request */
- bm->unit = -1;
- bm->dma_cb = NULL;
if (bm->aiocb) {
#ifdef DEBUG_AIO
printf("aio_cancel\n");
@@ -2849,6 +2845,10 @@ void ide_dma_cancel(BMDMAState *bm)
bdrv_aio_cancel(bm->aiocb);
bm->aiocb = NULL;
}
+ bm->status &= ~BM_STATUS_DMAING;
+ /* cancel DMA request */
+ bm->unit = -1;
+ bm->dma_cb = NULL;
}
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] ide: Fix ide_dma_cancel
2010-05-05 9:54 [Qemu-devel] [PATCH] ide: Fix ide_dma_cancel Kevin Wolf
@ 2010-05-05 18:48 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-05-05 18:48 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Wed, May 05, 2010 at 11:54:56AM +0200, Kevin Wolf wrote:
> When cancelling a request, bdrv_aio_cancel may decide that it waits for
> completion of a request rather than for cancellation. IDE therefore can't
> abandon its DMA status before calling bdrv_aio_cancel; otherwise the callback
> of a completed request would use invalid data.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
As mentioned before, looks good.
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-05 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 9:54 [Qemu-devel] [PATCH] ide: Fix ide_dma_cancel Kevin Wolf
2010-05-05 18:48 ` Christoph Hellwig
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).