From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: vsementsov@virtuozzo.com, qemu-block@nongnu.org
Subject: [PATCH 0/5] Obey NBD spec regarding block size bounds on reply
Date: Thu, 18 Feb 2021 14:15:23 -0600 [thread overview]
Message-ID: <20210218201528.127099-1-eblake@redhat.com> (raw)
We've had some known long-standing compliance bugs in our NBD server
not always honoring a minimum block size in its response to client
requests, when dealing with an image with a large block size backed by
another image with a smaller block size (for example, an encrypted
qcow2 image has a minimum block size of 512, backed by a file whose
size is not a multiple of 512). Fragmenting our reply to NBD_CMD_READ
or NBD_CMD_BLOCK_STATUS to something smaller than our advertised
minimum block size can confuse a client (in fact, qemu 3.2 would
abort() on such messages, although we patched the client to be
tolerant of non-compliant servers for qemu 4.0). Thankfully, most
day-to-day uses of NBD don't run into these cases.
Back in 2019, I did propose a fix for the server[1], but it was
incomplete at the time because I couldn't write a reliable iotest
(using blkdebug failed, because it was a filter that blocked access to
exposing the dirty bitmap), and the patches were too close to the 4.0
release for a corner case that did not occur frequently in practice,
so it moved to my back burner. But now that we have fixed the ability
to see through the blkdebug filter, and have in the meantime added the
qemu:allocation-depth context that also suffers from the same problem,
I have finally updated this series to a state that I'm happy with.
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-04/msg00589.html
Patch 5 is merely to aid in testing, by disabling the client
workaround that has been present since qemu 4.0 (since the revert is
no longer trivial).
Eric Blake (5):
iotests: Update 241 to expose backing layer fragmentation
block: Fix BDRV_BLOCK_RAW status to honor alignment
nbd/server: Avoid unaligned read/block_status from backing
nbd/server: Avoid unaligned dirty-bitmap status
do not apply: Revert "nbd-client: Work around server BLOCK_STATUS
misalignment at EOF"
block/coroutines.h | 2 +
include/block/block.h | 2 +
block/io.c | 210 ++++++++++++++++++++++++++++++++++---
block/nbd.c | 30 +-----
block/quorum.c | 7 +-
nbd/server.c | 42 ++++++--
tests/qemu-iotests/221 | 13 +++
tests/qemu-iotests/221.out | 9 ++
tests/qemu-iotests/241 | 58 +++++++++-
tests/qemu-iotests/241.out | 24 ++++-
10 files changed, 337 insertions(+), 60 deletions(-)
--
2.30.1
next reply other threads:[~2021-02-18 20:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 20:15 Eric Blake [this message]
2021-02-18 20:15 ` [PATCH 1/5] iotests: Update 241 to expose backing layer fragmentation Eric Blake
2021-02-25 13:50 ` Vladimir Sementsov-Ogievskiy
2021-02-25 14:57 ` Vladimir Sementsov-Ogievskiy
2021-02-25 15:52 ` Eric Blake
2021-02-25 16:04 ` Vladimir Sementsov-Ogievskiy
2021-02-25 15:46 ` Eric Blake
2021-02-18 20:15 ` [PATCH 2/5] block: Fix BDRV_BLOCK_RAW status to honor alignment Eric Blake
2021-02-25 14:55 ` Vladimir Sementsov-Ogievskiy
2021-02-25 16:03 ` Eric Blake
2021-02-25 16:23 ` Vladimir Sementsov-Ogievskiy
2021-02-18 20:15 ` [PATCH 3/5] nbd/server: Avoid unaligned read/block_status from backing Eric Blake
2021-02-18 20:15 ` [PATCH 4/5] nbd/server: Avoid unaligned dirty-bitmap status Eric Blake
2021-02-18 20:15 ` [PATCH 5/5] do not apply: Revert "nbd-client: Work around server BLOCK_STATUS misalignment at EOF" Eric Blake
2021-02-18 20:33 ` [PATCH 0/5] Obey NBD spec regarding block size bounds on reply no-reply
2021-02-18 20:40 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210218201528.127099-1-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).