Hi, As reported by Nir (https://lists.nongnu.org/archive/html/qemu-block/2022-01/msg00292.html) there’s a problem with the block-status cache, namely that it is updated when want_zero is false, but we return the result later even when the caller now passes want_zero=true. In the worst case, the want_zero=false call may have resulted in the cache containing an entry describing the whole image to contain data, and then all future requests will be served from that cache entry.
There are a couple ways this could be fixed (e.g. one cache per want_zero mode, or storing want_zero in the cache and comparing it when the cached data is fetched), but I think the simplest way is to only store want_zero=true block-status results in the cache. (This way, the cache will not work with want_zero=false, but the want_zero=true case is the one for which we introduced the cache in the first place. I think want_zero=false generally is fast enough(tm), that’s why we introduced want_zero after all.) Patch 1 is the fix, patch 2 a regression test. Hanna Reitz (2): block/io: Update BSC only if want_zero is true iotests/block-status-cache: New test block/io.c | 6 +- tests/qemu-iotests/tests/block-status-cache | 130 ++++++++++++++++++ .../qemu-iotests/tests/block-status-cache.out | 5 + 3 files changed, 140 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/tests/block-status-cache create mode 100644 tests/qemu-iotests/tests/block-status-cache.out -- 2.33.1