-----BEGIN PGP SIGNATURE-----

iQEcBAABAgAGBQJaDb5yAAoJEJykq7OBq3PIVRgIAK9flgXpoN0LsOwHjY8j3aEU
 FW418Z/4u9x+sfejqpSGlqoxWTH+weY1XE4QXA3cf13+7hq28z8woLJG/JgkM0Km
 PIH31OOOJxDuJZT2Wy0l+ddT0aDhEeqe1lNd3OLOW9NT/9pj+CPnLhbvXBT0ujuv
 M1Evv/xJFjurTXkOv7tpDDJ5c1NCS7ve/T/OqVmNLDTsgqwH1jsjV7d9tBO1MfHv
 rWBxBhE9O+carp9wLMkQLgL/KfjKVwHLArJIpU3R7FNa7qsZcT2ggCooTk70RncV
 uGrP58mliz+NygwRI5rj7DlSKh2ULdvApvpKJrTaupQH92FdOq9oKI+4LeIpkBY=
 =0muv
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Thu 16 Nov 2017 16:36:02 GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# 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: forget timer and schedule next TGM on detach

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-11-16 17:26:43 +00:00
commit afdad8b684
1 changed files with 12 additions and 0 deletions

View File

@ -593,13 +593,25 @@ void throttle_group_attach_aio_context(ThrottleGroupMember *tgm,
void throttle_group_detach_aio_context(ThrottleGroupMember *tgm)
{
ThrottleGroup *tg = container_of(tgm->throttle_state, ThrottleGroup, ts);
ThrottleTimers *tt = &tgm->throttle_timers;
int i;
/* Requests must have been drained */
assert(tgm->pending_reqs[0] == 0 && tgm->pending_reqs[1] == 0);
assert(qemu_co_queue_empty(&tgm->throttled_reqs[0]));
assert(qemu_co_queue_empty(&tgm->throttled_reqs[1]));
/* Kick off next ThrottleGroupMember, if necessary */
qemu_mutex_lock(&tg->lock);
for (i = 0; i < 2; i++) {
if (timer_pending(tt->timers[i])) {
tg->any_timer_armed[i] = false;
schedule_next_request(tgm, i);
}
}
qemu_mutex_unlock(&tg->lock);
throttle_timers_detach_aio_context(tt);
tgm->aio_context = NULL;
}