]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: all I/O should be completed before removing throttle timers.
authorZhengui <lizhengui@huawei.com>
Sat, 21 Oct 2017 05:34:00 +0000 (13:34 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 13 Nov 2017 14:02:05 +0000 (14:02 +0000)
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.

[Moved declaration of bs as suggested by Alberto Garcia
<berto@igalia.com>.
--Stefan]

Signed-off-by: Zhengui <lizhengui@huawei.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 1508564040-120700-1-git-send-email-lizhengui@huawei.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/block-backend.c

index 45d9101be3e337078379fc25fe838d9c908f2452..18e543780d7e030ab06d4a65646ae67ef4cdcd22 100644 (file)
@@ -655,12 +655,16 @@ BlockBackend *blk_by_public(BlockBackendPublic *public)
  */
 void blk_remove_bs(BlockBackend *blk)
 {
+    BlockDriverState *bs;
     ThrottleTimers *tt;
 
     notifier_list_notify(&blk->remove_bs_notifiers, blk);
     if (blk->public.throttle_group_member.throttle_state) {
         tt = &blk->public.throttle_group_member.throttle_timers;
+        bs = blk_bs(blk);
+        bdrv_drained_begin(bs);
         throttle_timers_detach_aio_context(tt);
+        bdrv_drained_end(bs);
     }
 
     blk_update_root_state(blk);