[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] aio: fix qemu_bh_schedule() bh->ctx race condit
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] aio: fix qemu_bh_schedule() bh->ctx race condition |
Date: |
Tue, 3 Jun 2014 14:49:03 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jun 03, 2014 at 11:21:01AM +0200, Stefan Hajnoczi wrote:
> qemu_bh_schedule() is supposed to be thread-safe at least the first time
> it is called. Unfortunately this is not quite true:
>
> bh->scheduled = 1;
> aio_notify(bh->ctx);
>
> Since another thread may run the BH callback once it has been scheduled,
> there is a race condition if the callback frees the BH before
> aio_notify(bh->ctx) has a chance to run.
>
> Reported-by: Stefan Priebe <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> async.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan