Bitmap fix for 2019-12-09
The following changes since commit 8350b17be015bb872f28268bdeba1bac6c380efc:
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191209' into staging (2019-12-09 11:07:34 +0000)
are available in the Git repository at:
https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2019-12-09
for you to fetch changes up to f56281abd957561b30538cbe606c3793b9b4c56d:
block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap (2019-12-09 09:23:04 -0600)
[I know I'm not the usual bitmap maintainer, but John agreed that I could get this posted faster than he could: it affects incremental bitmaps which is tangentially NBD-related, and we're already on a tight timeline given this is 4.2-rc5 material]
----------------------------------------------------------------
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
----------------------------------------------------------------
Vladimir Sementsov-Ogievskiy (1):
block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap
block/qcow2-bitmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.21.0
[PULL 1/1] pseries: Update SLOF firmware image
From: Alexey Kardashevskiy <[email protected]>
This fixes PCI bridge regression.
Alexey Kardashevskiy (3):
ibm,client-architecture-support: Fix stack handling
fdt: Fix updating the tree at H_CAS
version: update to 20191209
--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 928552 -> 931040 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
@@ -17,7 +17,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20191022. + built from git tag qemu-slof-20191209. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit 899d98836513bb3d6a4f4e48ef7cee887ee5f57b +Subproject commit 8ebf2f55e1ba1492b942ba4b682160e644fc0f98
Signature · 1 line
2.21.0
Re: [PULL 1/1] pseries: Update SLOF firmware image
Quoted 9 lines · Eric Blake
From: Alexey Kardashevskiy <[email protected]>
This fixes PCI bridge regression.
Alexey Kardashevskiy (3):
ibm,client-architecture-support: Fix stack handling
fdt: Fix updating the tree atH_CAS
version: update to 20191209
Quoted 7 lines
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 928552 -> 931040 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
No clue why my pull request script tried to mail this patch; the cover letter was correct. I'll resend the actual patch mentioned by the cover letter.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PULL 1/1] pseries: Update SLOF firmware image
In reply to Eric BlakeQuoted 4 lines · On Mon, 9 Dec 2019 10:00:15 -0600 Eric Blake <[email protected]> wrote:
From: Alexey Kardashevskiy <[email protected]>
This fixes PCI bridge regression.
Quoted 8 lines
Alexey Kardashevskiy (3):
ibm,client-architecture-support: Fix stack handling
fdt: Fix updating the tree atH_CAS
version: update to 20191209Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>---
This doesn't look like the right patch... this one belongs to David Gibson's PR that was merged earlier today.
Quoted 121 lines
pc-bios/README | 2 +- pc-bios/slof.bin | Bin 928552 -> 931040 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)pc-bios/README +1
-1@@ -17,7 +17,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20191022. + built from git tag qemu-slof-20191209. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console aspc-bios/slof.bin binary +0
-0roms/SLOF +1
-1@@ -1 +1 @@ -Subproject commit 899d98836513bb3d6a4f4e48ef7cee887ee5f57b +Subproject commit 8ebf2f55e1ba1492b942ba4b682160e644fc0f98
PATCH 1/1 block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap
In reply to Eric BlakeFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
Here is double bug:
First, return error but not set errp. This may lead to:
qmp block-dirty-bitmap-remove may report success when actually failed
block-dirty-bitmap-remove used in a transaction will crash, as qmp_transaction will think that it returned success and will call block_dirty_bitmap_remove_commit which will crash, as state->bitmap is NULL
Second (like in anecdote), this case is not an error at all. As it is documented in the comment above bdrv_co_remove_persistent_dirty_bitmap definition, absence of bitmap is not an error, and similar case handled at start of qcow2_co_remove_persistent_dirty_bitmap, it returns 0 when there is no bitmaps at all.
But when there are some bitmaps, but not the requested one, it return error with errp unset.
Fix that.
Trigger:
1. create persistent bitmap A
2. shutdown vm (bitmap A is synced)
3. start vm
4. create persistent bitmap B
5. remove bitmap B - it fails (and crashes if in transaction)
Potential workaround (rather invasive to ask clients to implement it):
1. create persistent bitmap A
2. shutdown vm
3. start vm
4. create persistent bitmap B
5. remember, that we want to remove bitmap B after vm shutdown
...
some other operations
...
6. vm shutdown
7. start vm in stopped mode, and remove all bitmaps marked for removing
8. stop vm
Message-Id: <[email protected]>
--- block/qcow2-bitmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
block/qcow2-bitmap.c +6 -3
@@ -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; }
Signature · 1 line
2.21.0
Re: [PATCH for 4.2-rc5 1/1] block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap
Did you mean to mark this as [PULL] ?
Quoted 81 lines · Eric Blake
From: Vladimir Sementsov-Ogievskiy <[email protected]>
Here is double bug:
First, return error but not set errp. This may lead to:
qmp block-dirty-bitmap-remove may report success when actually failedblock-dirty-bitmap-remove used in a transaction will crash, as
qmp_transactionwill think that it returned success and will callblock_dirty_bitmap_remove_commitwhich will crash, asstate->bitmapis NULLSecond (like in anecdote), this case is not an error at all. As it is documented in the comment above
bdrv_co_remove_persistent_dirty_bitmapdefinition, absence of bitmap is not an error, and similar case handled at start ofqcow2_co_remove_persistent_dirty_bitmap, it returns 0 when there is no bitmaps at all.But when there are some bitmaps, but not the requested one, it return error with errp unset.
Fix that.
Trigger:
1. create persistent bitmap A
2. shutdown vm (bitmap A is synced)
3. start vm
4. create persistent bitmap B
5. remove bitmap B - it fails (and crashes if in transaction)Potential workaround (rather invasive to ask clients to implement it):
1. create persistent bitmap A
2. shutdown vm
3. start vm
4. create persistent bitmap B
5. remember, that we want to remove bitmap B after vm shutdown
...
some other operations
...
6. vm shutdown
7. start vm in stopped mode, and remove all bitmaps marked for removing
8. stop vmFixes b56a1e31759b750Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Message-Id: <[email protected]>
Reviewed-by Eric Blake <[email protected]>Reviewed-by John Snow <[email protected]>[eblake: commit message tweaks]Signed-off-by Eric Blake <[email protected]>--- block/qcow2-bitmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)block/qcow2-bitmap.c +6
-3@@ -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; }
Signature · 1 line
—js
Re: [PATCH for 4.2-rc5 1/1] block/qcow2-bitmap: fix crash bug in qcow2_co_remove_persistent_dirty_bitmap
Quoted 1 line · John Snow
Did you mean to mark this as [PULL] ?
Probably - that's the curse of hand-editing a mail sent in-reply-to the cover letter after the fact, instead of sending a v2 of the overall pull request. At any rate, the correct commit made it in (f56281abd9).
Quoted 6 lines · Eric Blake
Quoted 4 lines
From: Vladimir Sementsov-Ogievskiy <[email protected]>
Here is double bug:
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Peter Maydell
AppliedQuoted 25 lines · Eric Blake
The following changes since commit
8350b17be015bb872f28268bdeba1bac6c380efc:Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191209' into staging (2019-12-09 11:07:34 +0000)
are available in the Git repository at:
https://repo.or.cz/qemu/ericb.git tags/pull-nbd-2019-12-09
for you to fetch changes up to
f56281abd957561b30538cbe606c3793b9b4c56d:
block/qcow2-bitmap: fix crash bug inqcow2_co_remove_persistent_dirty_bitmap(2019-12-09 09:23:04 -0600)[I know I'm not the usual bitmap maintainer, but John agreed that I could get this posted faster than he could: it affects incremental bitmaps which is tangentially NBD-related, and we're already on a tight timeline given this is 4.2-rc5 material]
----------------------------------------------------------------
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
Quoted 6 lines
----------------------------------------------------------------
Vladimir Sementsov-Ogievskiy (1):
block/qcow2-bitmap: fix crash bug inqcow2_co_remove_persistent_dirty_bitmapblock/qcow2-bitmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.
-- PMM