qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/2] block/io: Update BSC only if want_zero is true


From: Hanna Reitz
Subject: Re: [PATCH 0/2] block/io: Update BSC only if want_zero is true
Date: Mon, 17 Jan 2022 17:27:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

Forgot to CC qemu-stable.

On 17.01.22 17:26, Hanna Reitz wrote:
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]