All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block: all I/O should be completed before removing throttle timers.
@ 2017-10-21  5:34 Zhengui Li
  2017-10-21  5:49 ` no-reply
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Zhengui Li @ 2017-10-21  5:34 UTC (permalink / raw)
  To: kwolf, jcody, mreitz, pbonzini
  Cc: lizhengui, qemu-block, qemu-devel, eric.fangyi, subo7,
	lina.lulina, xieyingtai, sochin.jiang, wangjie88

From: Zhengui <lizhengui@huawei.com>

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 <lizhengui@huawei.com>
---
 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);
     }
 
     blk_update_root_state(blk);
-- 
2.7.2.windows.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-11-11  2:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-21  5:34 [Qemu-devel] [PATCH] block: all I/O should be completed before removing throttle timers Zhengui Li
2017-10-21  5:49 ` no-reply
2017-10-23 17:40 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-10-24  3:27   ` [Qemu-devel] 答复: " lizhengui
2017-11-09 16:59 ` [Qemu-devel] " Stefan Hajnoczi
2017-11-10  9:57 ` Alberto Garcia
2017-11-10 12:45 ` Alberto Garcia
2017-11-10 15:33 ` Stefan Hajnoczi
2017-11-11  2:37   ` l00284672

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.