qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

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>

authored by

Vladimir Sementsov-Ogievskiy and committed by
John Snow
fcd6a4f4 859443b0

+9 -3
+9 -3
block.c
··· 3486 3486 bs_entry->perms_checked = true; 3487 3487 } 3488 3488 3489 - /* If we reach this point, we have success and just need to apply the 3490 - * changes 3489 + /* 3490 + * If we reach this point, we have success and just need to apply the 3491 + * changes. 3492 + * 3493 + * Reverse order is used to comfort qcow2 driver: on commit it need to write 3494 + * IN_USE flag to the image, to mark bitmaps in the image as invalid. But 3495 + * children are usually goes after parents in reopen-queue, so go from last 3496 + * to first element. 3491 3497 */ 3492 - QTAILQ_FOREACH(bs_entry, bs_queue, entry) { 3498 + QTAILQ_FOREACH_REVERSE(bs_entry, bs_queue, entry) { 3493 3499 bdrv_reopen_commit(&bs_entry->state); 3494 3500 } 3495 3501