From: Hanna Reitz <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Nir Soffer <nsoffer@redhat.com>,
Hanna Reitz <hreitz@redhat.com>,
qemu-devel@nongnu.org
Subject: [PATCH 0/2] block/io: Update BSC only if want_zero is true
Date: Mon, 17 Jan 2022 17:26:47 +0100 [thread overview]
Message-ID: <20220117162649.193501-1-hreitz@redhat.com> (raw)
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
next reply other threads:[~2022-01-17 16:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 16:26 Hanna Reitz [this message]
2022-01-17 16:26 ` [PATCH 1/2] block/io: Update BSC only if want_zero is true 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220117162649.193501-1-hreitz@redhat.com \
--to=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=nsoffer@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).