[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/4] block: fix streaming/closing race
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/4] block: fix streaming/closing race |
Date: |
Fri, 30 Mar 2012 14:32:52 +0100 |
On Fri, Mar 30, 2012 at 12:17 PM, Paolo Bonzini <address@hidden> wrote:
> Streaming can issue I/O while qcow2_close is running. This causes the
> L2 caches to become very confused or, alternatively, could cause a
> segfault when the streaming coroutine is reentered after closing its
> block device. The fix is to cancel streaming jobs when closing their
> underlying device.
>
> The cancellation must be synchronous, on the other hand qemu_aio_wait
> will not restart a coroutine that is sleeping in co_sleep. So add
> a flag saying whether streaming has in-flight I/O. If the busy flag
> is false, the coroutine is quiescent and, when cancelled, will not
> issue any new I/O.
>
> This protects streaming against closing, but not against deleting.
> We have a reference count protecting us against concurrent deletion,
> but I still added an assertion to ensure nothing bad happens.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> block.c | 16 ++++++++++++++++
> block/stream.c | 6 ++++--
> block_int.h | 2 ++
> 3 files changed, 22 insertions(+), 2 deletions(-)
Reviewed-by: Stefan Hajnoczi <address@hidden>
- [Qemu-devel] [PATCH 0/4] Job API improvements and bugfixes, Paolo Bonzini, 2012/03/30
- [Qemu-devel] [PATCH 1/4] block: cancel jobs when a device is ready to go away, Paolo Bonzini, 2012/03/30
- [Qemu-devel] [PATCH 2/4] block: fix streaming/closing race, Paolo Bonzini, 2012/03/30
- Re: [Qemu-devel] [PATCH 2/4] block: fix streaming/closing race,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 4/4] block: document job API, Paolo Bonzini, 2012/03/30
- [Qemu-devel] [PATCH 3/4] block: set job->speed in block_set_speed, Paolo Bonzini, 2012/03/30
- Re: [Qemu-devel] [PATCH 0/4] Job API improvements and bugfixes, Stefan Hajnoczi, 2012/03/30