diff options
author | Roman Kagan | 2021-01-29 08:38:59 +0100 |
---|---|---|
committer | Eric Blake | 2021-02-03 15:17:12 +0100 |
commit | 5082fc82a6bc3fc06a04be47d39777c7cff61e5b (patch) | |
tree | 43d8289773e56056ba55e57d5d197d85e8445db9 /include/block/dirty-bitmap.h | |
parent | block/nbd: only enter connection coroutine if it's present (diff) | |
download | qemu-5082fc82a6bc3fc06a04be47d39777c7cff61e5b.tar.gz qemu-5082fc82a6bc3fc06a04be47d39777c7cff61e5b.tar.xz qemu-5082fc82a6bc3fc06a04be47d39777c7cff61e5b.zip |
nbd: make nbd_read* return -EIO on error
NBD reconnect logic considers the error code from the functions that
read NBD messages to tell if reconnect should be attempted or not: it is
attempted on -EIO, otherwise the client transitions to NBD_CLIENT_QUIT
state (see nbd_channel_error). This error code is propagated from the
primitives like nbd_read.
The problem, however, is that nbd_read itself turns every error into -1
rather than -EIO. As a result, if the NBD server happens to die while
sending the message, the client in QEMU receives less data than it
expects, considers it as a fatal error, and wouldn't attempt
reestablishing the connection.
Fix it by turning every negative return from qio_channel_read_all into
-EIO returned from nbd_read. Apparently that was the original behavior,
but got broken later. Also adjust nbd_readXX to follow.
Fixes: e6798f06a6 ("nbd: generalize usage of nbd_read")
Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210129073859.683063-4-rvkagan@yandex-team.ru>
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include/block/dirty-bitmap.h')
0 files changed, 0 insertions, 0 deletions