diff options
author | Eric Blake | 2017-11-08 22:57:03 +0100 |
---|---|---|
committer | Eric Blake | 2017-11-09 17:25:11 +0100 |
commit | ef8c887ee01a4e4c8c5c28c86ea5b45162c51bcd (patch) | |
tree | e6eaa1e3a1825c56e6da57211be6d4b61d59a8e3 /tests/test-aio-multithread.c | |
parent | nbd-client: Stricter enforcing of structured reply spec (diff) | |
download | qemu-ef8c887ee01a4e4c8c5c28c86ea5b45162c51bcd.tar.gz qemu-ef8c887ee01a4e4c8c5c28c86ea5b45162c51bcd.tar.xz qemu-ef8c887ee01a4e4c8c5c28c86ea5b45162c51bcd.zip |
nbd/server: Fix structured read of length 0
The NBD spec was recently clarified to state that a read of length 0
should not be attempted by a compliant client; but that a server must
still handle it correctly in an unspecified manner (that is, either
a successful no-op or an error reply, but not a crash) [1]. However,
it also implies that NBD_REPLY_TYPE_OFFSET_DATA must have a non-zero
payload length, but our existing code was replying with a chunk
that a picky client could reject as invalid because it was missing
a payload (our own client implementation was recently patched to be
that picky, after first fixing it to not send 0-length requests).
We are already doing successful no-ops for 0-length writes and for
non-structured reads; so for consistency, we want structured reply
reads to also be a no-op. The easiest way to do this is to return
a NBD_REPLY_TYPE_NONE chunk; this is best done via a new helper
function (especially since future patches for other structured
replies may benefit from using the same helper).
[1] https://github.com/NetworkBlockDevice/nbd/commit/ee926037
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171108215703.9295-8-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'tests/test-aio-multithread.c')
0 files changed, 0 insertions, 0 deletions