aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-03-25 16:34:10 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-03-25 16:34:10 +0000
commit63ad23fa240bb7cdbf6d0440c5670cc7935032b0 (patch)
tree2fe863b1512aa78d30da9faf6a0fa995e14b6737
parent9e2e9fe3df9f539f8b6941ceb96d25355fdae47e (diff)
parent3460fd7f3959d1fa7bcc255796844aa261c805a4 (diff)
downloadqemu-63ad23fa240bb7cdbf6d0440c5670cc7935032b0.zip
qemu-63ad23fa240bb7cdbf6d0440c5670cc7935032b0.tar.gz
qemu-63ad23fa240bb7cdbf6d0440c5670cc7935032b0.tar.bz2
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging
Pull request This dirty bitmap fix solves a crash that can be triggered in the destination QEMU process during live migration. # gpg: Signature made Wed 24 Mar 2021 14:51:31 GMT # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha-gitlab/tags/block-pull-request: migrate-bitmaps-postcopy-test: check that we can't remove in-flight bitmaps migration/block-dirty-bitmap: make incoming disabled bitmaps busy Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--migration/block-dirty-bitmap.c6
-rwxr-xr-xtests/qemu-iotests/tests/migrate-bitmaps-postcopy-test10
2 files changed, 16 insertions, 0 deletions
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 9750936..35f5ef6 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -839,6 +839,8 @@ static int dirty_bitmap_load_start(QEMUFile *f, DBMLoadState *s)
error_report_err(local_err);
return -EINVAL;
}
+ } else {
+ bdrv_dirty_bitmap_set_busy(s->bitmap, true);
}
b = g_new(LoadBitmapState, 1);
@@ -914,6 +916,8 @@ static void cancel_incoming_locked(DBMLoadState *s)
assert(!s->before_vm_start_handled || !b->migrated);
if (bdrv_dirty_bitmap_has_successor(b->bitmap)) {
bdrv_reclaim_dirty_bitmap(b->bitmap, &error_abort);
+ } else {
+ bdrv_dirty_bitmap_set_busy(b->bitmap, false);
}
bdrv_release_dirty_bitmap(b->bitmap);
}
@@ -951,6 +955,8 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s)
if (bdrv_dirty_bitmap_has_successor(s->bitmap)) {
bdrv_reclaim_dirty_bitmap(s->bitmap, &error_abort);
+ } else {
+ bdrv_dirty_bitmap_set_busy(s->bitmap, false);
}
for (item = s->bitmaps; item; item = g_slist_next(item)) {
diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
index d046ebe..584062b 100755
--- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
+++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
@@ -224,6 +224,16 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
self.start_postcopy()
self.vm_b_events += self.vm_b.get_qmp_events()
+
+ # While being here, let's check that we can't remove in-flight bitmaps.
+ for vm in (self.vm_a, self.vm_b):
+ for i in range(0, nb_bitmaps):
+ result = vm.qmp('block-dirty-bitmap-remove', node='drive0',
+ name=f'bitmap{i}')
+ self.assert_qmp(result, 'error/desc',
+ f"Bitmap 'bitmap{i}' is currently in use by "
+ "another operation and cannot be used")
+
self.vm_b.shutdown()
# recreate vm_b, so there is no incoming option, which prevents
# loading bitmaps from disk