|
|
7711c0 |
From 2b50f8a038624daf0b38795f33c7e9f5c21798a8 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Mon, 6 May 2019 17:56:27 +0200
|
|
|
7711c0 |
Subject: [PATCH 17/53] nbd/server: Don't fail NBD_OPT_INFO for byte-aligned
|
|
|
7711c0 |
sources
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190506175629.11079-18-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 87191
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 17/19] nbd/server: Don't fail NBD_OPT_INFO for byte-aligned sources
|
|
|
7711c0 |
Bugzilla: 1692018
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
From: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
In commit 0c1d50bd, I added a couple of TODO comments about whether we
|
|
|
7711c0 |
consult bl.request_alignment when responding to NBD_OPT_INFO. At the
|
|
|
7711c0 |
time, qemu as server was hard-coding an advertised alignment of 512 to
|
|
|
7711c0 |
clients that promised to obey constraints, and there was no function
|
|
|
7711c0 |
for getting at a device's preferred alignment. But in hindsight,
|
|
|
7711c0 |
advertising 512 when the block device prefers 1 caused other
|
|
|
7711c0 |
compliance problems, and commit b0245d64 changed one of the two TODO
|
|
|
7711c0 |
comments to advertise a more accurate alignment. Time to fix the other
|
|
|
7711c0 |
TODO. Doesn't really impact qemu as client (our normal client doesn't
|
|
|
7711c0 |
use NBD_OPT_INFO, and qemu-nbd --list promises to obey block sizes),
|
|
|
7711c0 |
but it might prove useful to other clients.
|
|
|
7711c0 |
|
|
|
7711c0 |
Fixes: b0245d64
|
|
|
7711c0 |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Message-Id: <20190403030526.12258-4-eblake@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
(cherry picked from commit 099fbcd65c2064a4ba8251e749bf600055027759)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
nbd/server.c | 13 ++++++++-----
|
|
|
7711c0 |
1 file changed, 8 insertions(+), 5 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/nbd/server.c b/nbd/server.c
|
|
|
7711c0 |
index 42f77ae..ad29373 100644
|
|
|
7711c0 |
--- a/nbd/server.c
|
|
|
7711c0 |
+++ b/nbd/server.c
|
|
|
7711c0 |
@@ -643,11 +643,14 @@ static int nbd_negotiate_handle_info(NBDClient *client, uint16_t myflags,
|
|
|
7711c0 |
return rc;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
- /* If the client is just asking for NBD_OPT_INFO, but forgot to
|
|
|
7711c0 |
- * request block sizes, return an error.
|
|
|
7711c0 |
- * TODO: consult blk_bs(blk)->request_align, and only error if it
|
|
|
7711c0 |
- * is not 1? */
|
|
|
7711c0 |
- if (client->opt == NBD_OPT_INFO && !blocksize) {
|
|
|
7711c0 |
+ /*
|
|
|
7711c0 |
+ * If the client is just asking for NBD_OPT_INFO, but forgot to
|
|
|
7711c0 |
+ * request block sizes in a situation that would impact
|
|
|
7711c0 |
+ * performance, then return an error. But for NBD_OPT_GO, we
|
|
|
7711c0 |
+ * tolerate all clients, regardless of alignments.
|
|
|
7711c0 |
+ */
|
|
|
7711c0 |
+ if (client->opt == NBD_OPT_INFO && !blocksize &&
|
|
|
7711c0 |
+ blk_get_request_alignment(exp->blk) > 1) {
|
|
|
7711c0 |
return nbd_negotiate_send_rep_err(client,
|
|
|
7711c0 |
NBD_REP_ERR_BLOCK_SIZE_REQD,
|
|
|
7711c0 |
errp,
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|