ed5979
From 6af6de77dace29aa8548b3649dc9c6163740ac86 Mon Sep 17 00:00:00 2001
ed5979
From: Kevin Wolf <kwolf@redhat.com>
ed5979
Date: Fri, 18 Nov 2022 18:41:03 +0100
ed5979
Subject: [PATCH 21/31] block: Don't use subtree drains in
ed5979
 bdrv_drop_intermediate()
ed5979
ed5979
RH-Author: Stefano Garzarella <sgarzare@redhat.com>
ed5979
RH-MergeRequest: 135: block: Simplify drain to prevent QEMU from crashing during snapshot
ed5979
RH-Bugzilla: 2155112
ed5979
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
ed5979
RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
ed5979
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
ed5979
RH-Commit: [9/16] 3c06fa826f262558f57d38b0155500c2e8e23a53 (sgarzarella/qemu-kvm-c-9-s)
ed5979
ed5979
Instead of using a subtree drain from the top node (which also drains
ed5979
child nodes of base that we're not even interested in), use a normal
ed5979
drain for base, which automatically drains all of the parents, too.
ed5979
ed5979
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ed5979
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
ed5979
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
ed5979
Message-Id: <20221118174110.55183-9-kwolf@redhat.com>
ed5979
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ed5979
(cherry picked from commit 631086deefc32690ee56efed1c5b891dec31ae37)
ed5979
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
ed5979
---
ed5979
 block.c | 4 ++--
ed5979
 1 file changed, 2 insertions(+), 2 deletions(-)
ed5979
ed5979
diff --git a/block.c b/block.c
ed5979
index cb5e96b1cf..b3449a312e 100644
ed5979
--- a/block.c
ed5979
+++ b/block.c
ed5979
@@ -5586,7 +5586,7 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
ed5979
     GLOBAL_STATE_CODE();
ed5979
 
ed5979
     bdrv_ref(top);
ed5979
-    bdrv_subtree_drained_begin(top);
ed5979
+    bdrv_drained_begin(base);
ed5979
 
ed5979
     if (!top->drv || !base->drv) {
ed5979
         goto exit;
ed5979
@@ -5659,7 +5659,7 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
ed5979
 
ed5979
     ret = 0;
ed5979
 exit:
ed5979
-    bdrv_subtree_drained_end(top);
ed5979
+    bdrv_drained_end(base);
ed5979
     bdrv_unref(top);
ed5979
     return ret;
ed5979
 }
ed5979
-- 
ed5979
2.31.1
ed5979