From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
vsementsov@virtuozzo.com, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: [PATCH 5/5] do not apply: Revert "nbd-client: Work around server BLOCK_STATUS misalignment at EOF"
Date: Thu, 18 Feb 2021 14:15:28 -0600 [thread overview]
Message-ID: <20210218201528.127099-6-eblake@redhat.com> (raw)
In-Reply-To: <20210218201528.127099-1-eblake@redhat.com>
This reverts commit 737d3f524481bb2ef68d3eba1caa636ff143e16a.
This is intended only for testing purposes: if you apply this without
the rest of the series, iotest 241 no longer benefits from the client
side working around server non-compliance.
---
block/nbd.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)
diff --git a/block/nbd.c b/block/nbd.c
index c26dc5a54f52..34c91f68e150 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -937,36 +937,14 @@ static int nbd_parse_blockstatus_payload(BDRVNBDState *s,
extent->length = payload_advance32(&payload);
extent->flags = payload_advance32(&payload);
- if (extent->length == 0) {
+ if (extent->length == 0 ||
+ (s->info.min_block && !QEMU_IS_ALIGNED(extent->length,
+ s->info.min_block))) {
error_setg(errp, "Protocol error: server sent status chunk with "
- "zero length");
+ "invalid length");
return -EINVAL;
}
- /*
- * A server sending unaligned block status is in violation of the
- * protocol, but as qemu-nbd 3.1 is such a server (at least for
- * POSIX files that are not a multiple of 512 bytes, since qemu
- * rounds files up to 512-byte multiples but lseek(SEEK_HOLE)
- * still sees an implicit hole beyond the real EOF), it's nicer to
- * work around the misbehaving server. If the request included
- * more than the final unaligned block, truncate it back to an
- * aligned result; if the request was only the final block, round
- * up to the full block and change the status to fully-allocated
- * (always a safe status, even if it loses information).
- */
- if (s->info.min_block && !QEMU_IS_ALIGNED(extent->length,
- s->info.min_block)) {
- trace_nbd_parse_blockstatus_compliance("extent length is unaligned");
- if (extent->length > s->info.min_block) {
- extent->length = QEMU_ALIGN_DOWN(extent->length,
- s->info.min_block);
- } else {
- extent->length = s->info.min_block;
- extent->flags = 0;
- }
- }
-
/*
* We used NBD_CMD_FLAG_REQ_ONE, so the server should not have
* sent us any more than one extent, nor should it have included
--
2.30.1
next prev parent reply other threads:[~2021-02-18 20:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 20:15 [PATCH 0/5] Obey NBD spec regarding block size bounds on reply Eric Blake
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 ` Eric Blake [this message]
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-6-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).