Bug report: https://bugs.launchpad.net/qemu/+bug/1570134
If you are doing a mirror operation (I just tested with block-commit on the active layer, but I guess any mirroring will do) while the guest has rather heavy I/O load (or light I/O also, you just need to be more unlucky) will lead to the cache of mirror's bitmap iterator becoming stale and not reflect all dirty bits which are set in the drive's dirty bitmap. Generally, this isn't bad because we just restart over once we are through, and this will refresh the iterator's cache. But it is bad for the code which tries to find a contiguous range of dirty chunks. This code needs to clear the bits in the iterator, so it invokes hbitmap_iter_next() for every contiguous dirty chunk found. But then it has to make sure that this actually cleared that chunk's dirty bit: And if the iterator's cache is stale, this may not be the case. Then, we run into a failed assertion. But detecting this discrepancy is easy and refreshing the iterator's cache is too; and then, the assertion holds. Besides this (patch 2), the code which is supposed to wait for overlapping in-flight requests on the first chunk of a dirty range is dead. I didn't produce any problems regarding that, but I'm sure it's not good. Patch 1 fixes that. Max Reitz (2): block/mirror: Revive dead yielding code block/mirror: Refresh stale bitmap iterator cache block/mirror.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) -- 2.8.0