bitmap fix for 4.2-rc5

- Fix a regression that broke bitmap deletion without a transaction,
 and causes a crash with transaction (only transaction is new to 4.2),
 when a qcow2 file contains persistent bitmaps from prior shutdown
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl3uaBMACgkQp6FrSiUn
 Q2rX+Af8Dn6cklzAizMLWCvXgEmbUhEvcVp5Gc9w34McCYokQaFDtNDuoShDIksa
 F01uP3TlKYd8JoMiGihqVP1mcof8dyGBNMX1fVr2iYIet0h7OAtzOfatXiHmaz4g
 r3utlx+0BHm+m9jhwsnCKp24ERa9izGmFQAIyaFLarGdasr29ArepCEXGXiOwtYF
 RwD+ioolN9wDcOHjRrEVLHKKRkiX9dSnxKxENahf+M2hVXD+UfbX4cumYxBWOxJQ
 qJpTznTA3BxRzUd3/Ue6NL0YmKmXLqHzyeX2Nc1NsdC485nCKn/QZtgI/8yAU0uL
 6nseBGa1kgF4+97LwGmPKUmumcxGmQ==
 =YAZ1
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-12-09' into staging

bitmap fix for 4.2-rc5

- Fix a regression that broke bitmap deletion without a transaction,
and causes a crash with transaction (only transaction is new to 4.2),
when a qcow2 file contains persistent bitmaps from prior shutdown

# gpg: Signature made Mon 09 Dec 2019 15:28:19 GMT
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2019-12-09:
  block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
master
Peter Maydell 2019-12-09 16:06:51 +00:00
commit 9b4efa2ede
1 changed files with 6 additions and 3 deletions

View File

@ -1469,8 +1469,10 @@ int coroutine_fn qcow2_co_remove_persistent_dirty_bitmap(BlockDriverState *bs,
Qcow2BitmapList *bm_list;
if (s->nb_bitmaps == 0) {
/* Absence of the bitmap is not an error: see explanation above
* bdrv_remove_persistent_dirty_bitmap() definition. */
/*
* Absence of the bitmap is not an error: see explanation above
* bdrv_co_remove_persistent_dirty_bitmap() definition.
*/
return 0;
}
@ -1485,7 +1487,8 @@ int coroutine_fn qcow2_co_remove_persistent_dirty_bitmap(BlockDriverState *bs,
bm = find_bitmap_by_name(bm_list, name);
if (bm == NULL) {
ret = -EINVAL;
/* Absence of the bitmap is not an error, see above. */
ret = 0;
goto out;
}