aboutsummaryrefslogtreecommitdiff
path: root/block/io.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-01-30 10:00:28 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-01-30 10:00:28 +0000
commitbfc3db5cf64ab538d6b3c56eab6423372758b258 (patch)
tree9b106dcbaba1ec1213ba747c9996a703429990b6 /block/io.c
parentd90e6f665d3ac197f83d93ad37147fe677521209 (diff)
parent6384dd534d742123d26c008d9794b20bc41359d5 (diff)
downloadqemu-bfc3db5cf64ab538d6b3c56eab6423372758b258.zip
qemu-bfc3db5cf64ab538d6b3c56eab6423372758b258.tar.gz
qemu-bfc3db5cf64ab538d6b3c56eab6423372758b258.tar.bz2
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2022-01-28' into staging
nbd patches for 2022-01-28 - Hanna Reitz: regression fix for block status caching - Philippe Mathieu-Daude: documentation formatting - Nir Soffer: dead code removal # gpg: Signature made Fri 28 Jan 2022 22:58:50 GMT # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2022-01-28: iotests/block-status-cache: New test block/io: Update BSC only if want_zero is true qapi/block: Cosmetic change in BlockExportType schema nbd/server.c: Remove unused field Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/io.c b/block/io.c
index bb0a254..4e4cb55 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2497,8 +2497,12 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs,
* non-protocol nodes, and then it is never used. However, filling
* the cache requires an RCU update, so double check here to avoid
* such an update if possible.
+ *
+ * Check want_zero, because we only want to update the cache when we
+ * have accurate information about what is zero and what is data.
*/
- if (ret == (BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID) &&
+ if (want_zero &&
+ ret == (BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID) &&
QLIST_EMPTY(&bs->children))
{
/*