summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-19 15:38:06 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-19 15:38:06 +0100
commite1ea55668ffe6ce558a063f3a9621b761738e1f2 (patch)
tree818872f66e25eb93118adbc79f7c3137173a2478
parent771eab934943ecfd38e16eab39061d6c458deb6c (diff)
parent6fccbb475bc6effc313ee9481726a1748b6dae57 (diff)
downloadfocaccia-qemu-e1ea55668ffe6ce558a063f3a9621b761738e1f2.tar.gz
focaccia-qemu-e1ea55668ffe6ce558a063f3a9621b761738e1f2.zip
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Pull request

This fix prevents hangs when a drive leaves a throttling group.

# gpg: Signature made Thu 19 Jul 2018 15:28:37 BST
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  throttle-groups: fix hang when group member leaves

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--block/throttle-groups.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 36cc0430c3..e297b04e17 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -564,6 +564,10 @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm)
 
     qemu_mutex_lock(&tg->lock);
     for (i = 0; i < 2; i++) {
+        if (timer_pending(tgm->throttle_timers.timers[i])) {
+            tg->any_timer_armed[i] = false;
+            schedule_next_request(tgm, i);
+        }
         if (tg->tokens[i] == tgm) {
             token = throttle_group_next_tgm(tgm);
             /* Take care of the case where this is the last tgm in the group */