io_uring: fix short read slow path
commitc06fc7ce147e57ab493bad9263f1601b8298484b
authorDominique Martinet <dominique.martinet@atmark-techno.com>
Thu, 30 Jun 2022 01:01:37 +0000 (30 10:01 +0900)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 7 Jul 2022 08:04:12 +0000 (7 09:04 +0100)
tree11e870f697e622bc13c34846e62892eb7bf168ea
parent8e9398e3b1a860b8c29c670c1b6c36afe8d87849
io_uring: fix short read slow path

sqeq.off here is the offset to read within the disk image, so obviously
not 'nread' (the amount we just read), but as the author meant to write
its current value incremented by the amount we just read.

Normally recent versions of linux will not issue short reads,
but it can happen so we should fix this.

This lead to weird image corruptions when short read happened

Fixes: 6663a0a33764 ("block/io_uring: implements interfaces for io_uring")
Link: https://lkml.kernel.org/r/YrrFGO4A1jS0GI0G@atmark-techno.com
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Message-Id: <20220630010137.2518851-1-dominique.martinet@atmark-techno.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/io_uring.c