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

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