[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH] block: all I/O should be completed
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH] block: all I/O should be completed before removing throttle timers. |
Date: |
Fri, 10 Nov 2017 13:45:15 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Sat 21 Oct 2017 07:34:00 AM CEST, Zhengui Li wrote:
> From: Zhengui <address@hidden>
>
> In blk_remove_bs, all I/O should be completed before removing throttle
> timers. If there has inflight I/O, removing throttle timers here will
> cause the inflight I/O never return.
> This patch add bdrv_drained_begin before throttle_timers_detach_aio_context
> to let all I/O completed before removing throttle timers.
>
> Signed-off-by: Zhengui <address@hidden>
> ---
> block/block-backend.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 45d9101..9edc452 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -660,7 +660,11 @@ void blk_remove_bs(BlockBackend *blk)
> notifier_list_notify(&blk->remove_bs_notifiers, blk);
> if (blk->public.throttle_group_member.throttle_state) {
> tt = &blk->public.throttle_group_member.throttle_timers;
> + BlockDriverState *bs;
> + bs = blk_bs(blk);
> + bdrv_drained_begin(bs);
> throttle_timers_detach_aio_context(tt);
> + bdrv_drained_end(bs);
You can keep my R-b, but seeing this in context I think you should
define BlockDriverState either at the beginning of the block or together
with ThrottleTimers at the beginning of the function.
Berto