qemu-e2k/include/block
Roman Kagan 5082fc82a6 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>
2021-02-03 08:17:12 -06:00
..
accounting.h
aio_task.h
aio-wait.h
aio.h util/async: Add aio_co_reschedule_self() 2020-10-09 07:08:20 +02:00
block_backup.h
block_int.h block/io: use int64_t bytes in copy_range 2021-02-03 08:17:12 -06:00
block-copy.h block/block-copy: drop unused argument of block_copy() 2021-01-26 14:36:37 +01:00
block-hmp-cmds.h
block.h block/io: use int64_t bytes in copy_range 2021-02-03 08:17:12 -06:00
blockjob_int.h blockjob: add set_speed to BlockJobDriver 2021-01-26 14:36:37 +01:00
blockjob.h
dirty-bitmap.h
export.h
fuse.h fuse: Allow exporting BDSs via FUSE 2020-12-11 17:52:39 +01:00
nbd.h nbd: make nbd_read* return -EIO on error 2021-02-03 08:17:12 -06:00
nvme.h block/nvme: Introduce Completion Queue definitions 2020-11-03 19:06:21 +00:00
qapi.h
qdict.h
raw-aio.h
snapshot.h migration: introduce icount field for snapshots 2020-10-06 08:34:49 +02:00
thread-pool.h
throttle-groups.h block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes 2021-02-03 08:14:00 -06:00
write-threshold.h