All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] block/io: Update BSC only if want_zero is true
@ 2022-01-17 16:26 Hanna Reitz
  2022-01-17 16:26 ` [PATCH 1/2] " Hanna Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hanna Reitz @ 2022-01-17 16:26 UTC (permalink / raw)
  To: qemu-block; +Cc: Kevin Wolf, Nir Soffer, Hanna Reitz, qemu-devel

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-18 17:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 16:26 [PATCH 0/2] block/io: Update BSC only if want_zero is true Hanna Reitz
2022-01-17 16:26 ` [PATCH 1/2] " Hanna Reitz
2022-01-17 18:15   ` Nir Soffer
2022-01-17 16:26 ` [PATCH 2/2] iotests/block-status-cache: New test Hanna Reitz
2022-01-17 17:57   ` Nir Soffer
2022-01-18 16:41     ` Hanna Reitz
2022-01-17 16:27 ` [PATCH 0/2] block/io: Update BSC only if want_zero is true Hanna Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.