Blame SOURCES/kvm-block-all-I-O-should-be-completed-before-removing-th.patch

4a2fec
From 18d530eed9ea334b2235a1a7ae5801ee23c57290 Mon Sep 17 00:00:00 2001
4a2fec
From: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Date: Fri, 17 Nov 2017 11:19:03 +0100
4a2fec
Subject: [PATCH 04/15] block: all I/O should be completed before removing
4a2fec
 throttle timers.
4a2fec
4a2fec
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Message-id: <20171117111908.8815-5-stefanha@redhat.com>
4a2fec
Patchwork-id: 77738
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 4/9] block: all I/O should be completed before removing throttle timers.
4a2fec
Bugzilla: 1492295
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
4a2fec
From: Zhengui <lizhengui@huawei.com>
4a2fec
4a2fec
In blk_remove_bs, all I/O should be completed before removing throttle
4a2fec
timers. If there has inflight I/O, removing throttle timers here will
4a2fec
cause the inflight I/O never return.
4a2fec
This patch add bdrv_drained_begin before throttle_timers_detach_aio_context
4a2fec
to let all I/O completed before removing throttle timers.
4a2fec
4a2fec
[Moved declaration of bs as suggested by Alberto Garcia
4a2fec
<berto@igalia.com>.
4a2fec
--Stefan]
4a2fec
4a2fec
Signed-off-by: Zhengui <lizhengui@huawei.com>
4a2fec
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Reviewed-by: Alberto Garcia <berto@igalia.com>
4a2fec
Message-id: 1508564040-120700-1-git-send-email-lizhengui@huawei.com
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
(cherry picked from commit 632a77354317df32c7ff2d23424f0559c23fee51)
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 block/block-backend.c | 4 ++++
4a2fec
 1 file changed, 4 insertions(+)
4a2fec
4a2fec
diff --git a/block/block-backend.c b/block/block-backend.c
4a2fec
index 6826476..bfb3e84 100644
4a2fec
--- a/block/block-backend.c
4a2fec
+++ b/block/block-backend.c
4a2fec
@@ -655,12 +655,16 @@ BlockBackend *blk_by_public(BlockBackendPublic *public)
4a2fec
  */
4a2fec
 void blk_remove_bs(BlockBackend *blk)
4a2fec
 {
4a2fec
+    BlockDriverState *bs;
4a2fec
     ThrottleTimers *tt;
4a2fec
 
4a2fec
     notifier_list_notify(&blk->remove_bs_notifiers, blk);
4a2fec
     if (blk->public.throttle_group_member.throttle_state) {
4a2fec
         tt = &blk->public.throttle_group_member.throttle_timers;
4a2fec
+        bs = blk_bs(blk);
4a2fec
+        bdrv_drained_begin(bs);
4a2fec
         throttle_timers_detach_aio_context(tt);
4a2fec
+        bdrv_drained_end(bs);
4a2fec
     }
4a2fec
 
4a2fec
     blk_update_root_state(blk);
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec