|
|
383d26 |
From b8a78d2f99bb481e78686ef2e0beb369b5563d87 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Date: Tue, 3 Sep 2019 15:28:28 +0200
|
|
|
383d26 |
Subject: [PATCH 23/23] block: Drain source node in bdrv_replace_node()
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Message-id: <20190903152828.15668-2-kwolf@redhat.com>
|
|
|
383d26 |
Patchwork-id: 90257
|
|
|
383d26 |
O-Subject: [RHEL-7.7.z qemu-kvm PATCH 1/1] block: Drain source node in bdrv_replace_node()
|
|
|
383d26 |
Bugzilla: 1711643
|
|
|
383d26 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
Instead of just asserting that no requests are in flight in
|
|
|
383d26 |
bdrv_replace_node(), which is a requirement that most callers ignore, we
|
|
|
383d26 |
can just drain the source node right there. This fixes at least starting
|
|
|
383d26 |
a commit job while I/O is active on the backing chain, but probably
|
|
|
383d26 |
other callers, too.
|
|
|
383d26 |
|
|
|
383d26 |
Having requests in flight on the target node isn't a problem because the
|
|
|
383d26 |
target just gets new parents, but the call path of running requests
|
|
|
383d26 |
isn't modified. So we can just drop this assertion without a replacement.
|
|
|
383d26 |
|
|
|
383d26 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1711643
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
(cherry picked from commit f871abd60f4b67547e62c57c9bec19420052be39)
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
block.c | 7 ++++---
|
|
|
383d26 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/block.c b/block.c
|
|
|
383d26 |
index 7061f9b..4986516 100644
|
|
|
383d26 |
--- a/block.c
|
|
|
383d26 |
+++ b/block.c
|
|
|
383d26 |
@@ -3505,13 +3505,13 @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to,
|
|
|
383d26 |
uint64_t perm = 0, shared = BLK_PERM_ALL;
|
|
|
383d26 |
int ret;
|
|
|
383d26 |
|
|
|
383d26 |
- assert(!atomic_read(&from->in_flight));
|
|
|
383d26 |
- assert(!atomic_read(&to->in_flight));
|
|
|
383d26 |
-
|
|
|
383d26 |
/* Make sure that @from doesn't go away until we have successfully attached
|
|
|
383d26 |
* all of its parents to @to. */
|
|
|
383d26 |
bdrv_ref(from);
|
|
|
383d26 |
|
|
|
383d26 |
+ assert(qemu_get_current_aio_context() == qemu_get_aio_context());
|
|
|
383d26 |
+ bdrv_drained_begin(from);
|
|
|
383d26 |
+
|
|
|
383d26 |
/* Put all parents into @list and calculate their cumulative permissions */
|
|
|
383d26 |
QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) {
|
|
|
383d26 |
if (!should_update_child(c, to)) {
|
|
|
383d26 |
@@ -3546,6 +3546,7 @@ void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to,
|
|
|
383d26 |
|
|
|
383d26 |
out:
|
|
|
383d26 |
g_slist_free(list);
|
|
|
383d26 |
+ bdrv_drained_end(from);
|
|
|
383d26 |
bdrv_unref(from);
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|