]> git.ipfire.org Git - thirdparty/qemu.git/commit
file-posix: fix over-writing of returning zone_append offset
authorNaohiro Aota <nao.aota@gmail.com>
Mon, 30 Oct 2023 07:38:53 +0000 (16:38 +0900)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 9 Nov 2023 13:39:13 +0000 (16:39 +0300)
commitbcc9879c1c83c930c656f57e5444e1adc18c206f
tree3f51069120fe6d29c2f312bd2a6a3a88482b6319
parenta753815aa8b2ce9d72a7494c940485b5d885ba98
file-posix: fix over-writing of returning zone_append offset

raw_co_zone_append() sets "s->offset" where "BDRVRawState *s". This pointer
is used later at raw_co_prw() to save the block address where the data is
written.

When multiple IOs are on-going at the same time, a later IO's
raw_co_zone_append() call over-writes a former IO's offset address before
raw_co_prw() completes. As a result, the former zone append IO returns the
initial value (= the start address of the writing zone), instead of the
proper address.

Fix the issue by passing the offset pointer to raw_co_prw() instead of
passing it through s->offset. Also, remove "offset" from BDRVRawState as
there is no usage anymore.

Fixes: 4751d09adcc3 ("block: introduce zone append write for zoned devices")
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Message-Id: <20231030073853.2601162-1-naohiro.aota@wdc.com>
Reviewed-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
(cherry picked from commit ad4feaca61d76fecad784e6d5e7bae40d0411c46)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
block/file-posix.c