[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] throttle-groups: update tg->any_timer_armed[] o
From: |
Michael Roth |
Subject: |
Re: [Qemu-devel] [PATCH] throttle-groups: update tg->any_timer_armed[] on detach |
Date: |
Mon, 25 Sep 2017 15:50:59 -0500 |
User-agent: |
alot/0.6 |
Quoting Stefan Hajnoczi (2017-09-19 10:50:25)
> Clear tg->any_timer_armed[] when throttling timers are destroy during
> AioContext attach/detach. Failure to do so causes throttling to hang
> because we believe the timer is already scheduled!
>
> The following was broken at least since QEMU 2.10.0 with -drive
> iops=100:
>
> $ dd if=/dev/zero of=/dev/vdb oflag=direct count=1000
> (qemu) stop
> (qemu) cont
> ...I/O is stuck...
>
> Reported-by: Yongxue Hong <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
FYI: this patch has been tagged for stable 2.10.1, but is not yet
upstream. Patch freeze for 2.10.1 is September 27th.
> ---
> block/throttle-groups.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/block/throttle-groups.c b/block/throttle-groups.c
> index 6ba992c8d7..2bfd03faa0 100644
> --- a/block/throttle-groups.c
> +++ b/block/throttle-groups.c
> @@ -592,7 +592,20 @@ void
> throttle_group_attach_aio_context(ThrottleGroupMember *tgm,
> void throttle_group_detach_aio_context(ThrottleGroupMember *tgm)
> {
> ThrottleTimers *tt = &tgm->throttle_timers;
> + ThrottleGroup *tg = container_of(tgm->throttle_state, ThrottleGroup, ts);
> +
> throttle_timers_detach_aio_context(tt);
> +
> + /* Forget about these timers, they have been destroyed */
> + qemu_mutex_lock(&tg->lock);
> + if (tg->tokens[0] == tgm) {
> + tg->any_timer_armed[0] = false;
> + }
> + if (tg->tokens[1] == tgm) {
> + tg->any_timer_armed[1] = false;
> + }
> + qemu_mutex_unlock(&tg->lock);
> +
> tgm->aio_context = NULL;
> }
>
> --
> 2.13.5
>
>