Skip to content

Commit

Permalink
aio: fix aio_ctx_prepare with idle bottom halves
Browse files Browse the repository at this point in the history
Commit ed2aec4867f0d5f5de496bb765347b5d0cfe113d changed the return
value of aio_ctx_prepare from false to true when only idle bottom
halves are available.  This broke PC old-style DMA, which uses them.
Fix this by making aio_ctx_prepare return true only when non-idle
bottom halves are scheduled to run.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
  • Loading branch information
bonzini authored and malc committed Nov 12, 2012
1 parent 3c5645f commit f5022a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions async.c
Expand Up @@ -122,11 +122,9 @@ aio_ctx_prepare(GSource *source, gint *timeout)
{
AioContext *ctx = (AioContext *) source;
QEMUBH *bh;
bool scheduled = false;

for (bh = ctx->first_bh; bh; bh = bh->next) {
if (!bh->deleted && bh->scheduled) {
scheduled = true;
if (bh->idle) {
/* idle bottom halves will be polled at least
* every 10ms */
Expand All @@ -135,12 +133,12 @@ aio_ctx_prepare(GSource *source, gint *timeout)
/* non-idle bottom halves will be executed
* immediately */
*timeout = 0;
break;
return true;
}
}
}

return scheduled;
return false;
}

static gboolean
Expand Down

0 comments on commit f5022a1

Please sign in to comment.