Pull request

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbPGpGAAoJEH3vgQaq/DkOHJcQAK8S58jlhHVyTb8RMbOHGGsB
 L5xRqGQ5KcR8M4c3iR1L4Qdg+XwR5qDpY+G48/oWKoeu/lR/GFvywz+F2T65+y04
 M4MQuS2aPrXVDCHt6aUXm31OPM7PKpu8QIRnjLXXnxnGFbSsc+ajW1wErRajFD3W
 T5TdKv8pEyPnGCm88ICpzNwo34ucYppGd7/zt70BfZ5W0pgNJ537V71N0NQ8d+aH
 e7t5Qk1IqUX6Vv9L4ld7BmkVP1VDyHVTAQEPds+SuNpCThwqkDNd0AN+0NPe+9pC
 /acBUHupZOj06UebBPEgmOzW6jeYgC7C4ccya0foVh5wjrc/l6oNpKqo80YJDrfb
 /NQV/EIahSyH1sx3kKr1zVCFZO8MHNB4WwxC65g2bNs9IqNet6RNWAxnqtPEDvYr
 uVt5MK+53Te6+Ni7nWnwlVHn2NMUDjrXlfpMby9gGUBn6Wj9SLZP8FrWS/aNMFia
 F4ejU2mLRRNzq4YcetWAXRDH1sLPbGFV1dZP+LPXVVfa2Qrh+CBMpp85eOuXGuro
 iQ79E1vdr4YlbDKnEgK3swiwqdm98SUJV/CQM+BBzL5RtGZRH1vIjdeaJP/4klAd
 dedOEf6+9gBau7aTNO7RryWFp8UGvTYwh4dCmFWfqsFi6KyjyttzFMcT3BTwBzRY
 535nm38CknYvIGCnSnoj
 =48Zh
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging

Pull request

# gpg: Signature made Wed 04 Jul 2018 07:33:42 BST
# gpg:                using RSA key 7DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/bitmaps-pull-request:
  dirty-bitmap: fix double lock on bitmap enabling
  block/dirty-bitmap: add bdrv_enable_dirty_bitmap_locked

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-07-05 13:33:52 +01:00
commit 6cf495be0b
3 changed files with 12 additions and 5 deletions

View File

@ -241,11 +241,18 @@ int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
return 0;
}
void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap)
{
assert(!bdrv_dirty_bitmap_frozen(bitmap));
bitmap->disabled = false;
}
/* Called with BQL taken. */
void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap)
{
assert(bitmap->mutex == bitmap->successor->mutex);
qemu_mutex_lock(bitmap->mutex);
bdrv_enable_dirty_bitmap(bitmap->successor);
bdrv_enable_dirty_bitmap_locked(bitmap->successor);
qemu_mutex_unlock(bitmap->mutex);
}
@ -424,8 +431,7 @@ void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
{
bdrv_dirty_bitmap_lock(bitmap);
assert(!bdrv_dirty_bitmap_frozen(bitmap));
bitmap->disabled = false;
bdrv_enable_dirty_bitmap_locked(bitmap);
bdrv_dirty_bitmap_unlock(bitmap);
}

View File

@ -32,6 +32,7 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
Error **errp);
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
void bdrv_enable_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap);
BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap *bitmap);

View File

@ -511,7 +511,7 @@ void dirty_bitmap_mig_before_vm_start(void)
DirtyBitmapLoadBitmapState *b = item->data;
if (b->migrated) {
bdrv_enable_dirty_bitmap(b->bitmap);
bdrv_enable_dirty_bitmap_locked(b->bitmap);
} else {
bdrv_dirty_bitmap_enable_successor(b->bitmap);
}
@ -547,7 +547,7 @@ static void dirty_bitmap_load_complete(QEMUFile *f, DirtyBitmapLoadState *s)
if (enabled_bitmaps == NULL) {
/* in postcopy */
bdrv_reclaim_dirty_bitmap_locked(s->bs, s->bitmap, &error_abort);
bdrv_enable_dirty_bitmap(s->bitmap);
bdrv_enable_dirty_bitmap_locked(s->bitmap);
} else {
/* target not started, successor must be empty */
int64_t count = bdrv_get_dirty_count(s->bitmap);