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>
This commit is contained in:
parent
859443b0fb
commit
fcd6a4f42d
12
block.c
12
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user