diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2019-09-27 15:23:48 +0300 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2019-10-17 17:02:32 -0400 |
commit | fcd6a4f42deef7e9f28c7b82f7d340200fb7846e (patch) | |
tree | 45e6afb23e600531f5cac946d919c4243d803d07 /block.c | |
parent | 859443b0fb7eba258325f75f6444270c50008e65 (diff) | |
download | qemu-fcd6a4f42deef7e9f28c7b82f7d340200fb7846e.zip qemu-fcd6a4f42deef7e9f28c7b82f7d340200fb7846e.tar.gz qemu-fcd6a4f42deef7e9f28c7b82f7d340200fb7846e.tar.bz2 |
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.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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); } |