summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy2019-09-27 14:23:48 +0200
committerJohn Snow2019-10-17 23:02:32 +0200
commitfcd6a4f42deef7e9f28c7b82f7d340200fb7846e (patch)
tree45e6afb23e600531f5cac946d919c4243d803d07 /block.c
parentblock: switch reopen queue from QSIMPLEQ to QTAILQ (diff)
downloadqemu-fcd6a4f42deef7e9f28c7b82f7d340200fb7846e.tar.gz
qemu-fcd6a4f42deef7e9f28c7b82f7d340200fb7846e.tar.xz
qemu-fcd6a4f42deef7e9f28c7b82f7d340200fb7846e.zip
block: reverse order for reopen commits
It's needed to fix reopening qcow2 with bitmaps to RW. Currently it can't work, as qcow2 needs write access to file child, to mark bitmaps in-image with IN_USE flag. But usually children goes after parents in reopen queue and file child is still RO on qcow2 reopen commit. Reverse reopen order to fix it. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Acked-by: Max Reitz <mreitz@redhat.com> Acked-by: John Snow <jsnow@redhat.com> Message-id: 20190927122355.7344-3-vsementsov@virtuozzo.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/block.c b/block.c
index 0347632c6c..cf312258a9 100644
--- a/block.c
+++ b/block.c
@@ -3486,10 +3486,16 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp)
bs_entry->perms_checked = true;
}
- /* If we reach this point, we have success and just need to apply the
- * changes
+ /*
+ * If we reach this point, we have success and just need to apply the
+ * changes.
+ *
+ * Reverse order is used to comfort qcow2 driver: on commit it need to write
+ * IN_USE flag to the image, to mark bitmaps in the image as invalid. But
+ * children are usually goes after parents in reopen-queue, so go from last
+ * to first element.
*/
- QTAILQ_FOREACH(bs_entry, bs_queue, entry) {
+ QTAILQ_FOREACH_REVERSE(bs_entry, bs_queue, entry) {
bdrv_reopen_commit(&bs_entry->state);
}