|
|
7711c0 |
From b9bef7082ee3ffe7f7f66b719e07a8ad37e3eaff Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Mon, 6 May 2019 17:56:14 +0200
|
|
|
7711c0 |
Subject: [PATCH 04/53] nbd: Permit simple error to NBD_CMD_BLOCK_STATUS
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190506175629.11079-5-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 87186
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 04/19] nbd: Permit simple error to NBD_CMD_BLOCK_STATUS
|
|
|
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 |
The NBD spec is clear that when structured replies are active, a
|
|
|
7711c0 |
simple error reply is acceptable to any command except for
|
|
|
7711c0 |
NBD_CMD_READ. However, we were mistakenly requiring structured errors
|
|
|
7711c0 |
for NBD_CMD_BLOCK_STATUS, and hanging up on a server that gave a
|
|
|
7711c0 |
simple error (since qemu does not behave as such a server, we didn't
|
|
|
7711c0 |
notice the problem until now). Broken since its introduction in
|
|
|
7711c0 |
commit 78a33ab5 (v2.12).
|
|
|
7711c0 |
|
|
|
7711c0 |
Noticed while debugging a separate failure reported by nbdkit while
|
|
|
7711c0 |
working out its initial implementation of BLOCK_STATUS, although it
|
|
|
7711c0 |
turns out that nbdkit also chose to send structured error replies for
|
|
|
7711c0 |
BLOCK_STATUS, so I had to manually provoke the situation by hacking
|
|
|
7711c0 |
qemu's server to send a simple error reply:
|
|
|
7711c0 |
|
|
|
7711c0 |
| diff --git i/nbd/server.c w/nbd/server.c
|
|
|
7711c0 |
| index fd013a2817a..833288d7c45 100644
|
|
|
7711c0 |
| 00--- i/nbd/server.c
|
|
|
7711c0 |
| +++ w/nbd/server.c
|
|
|
7711c0 |
| @@ -2269,6 +2269,8 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
|
|
|
7711c0 |
| "discard failed", errp);
|
|
|
7711c0 |
|
|
|
|
7711c0 |
| case NBD_CMD_BLOCK_STATUS:
|
|
|
7711c0 |
| + return nbd_co_send_simple_reply(client, request->handle, ENOMEM,
|
|
|
7711c0 |
| + NULL, 0, errp);
|
|
|
7711c0 |
| if (!request->len) {
|
|
|
7711c0 |
| return nbd_send_generic_reply(client, request->handle, -EINVAL,
|
|
|
7711c0 |
| "need non-zero length", errp);
|
|
|
7711c0 |
|
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Acked-by: Richard W.M. Jones <rjones@redhat.com>
|
|
|
7711c0 |
Message-Id: <20190325190104.30213-3-eblake@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
(cherry picked from commit ebd82cd872726549d0a55d329d22c731e2e660ff)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
block/nbd-client.c | 4 +---
|
|
|
7711c0 |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/block/nbd-client.c b/block/nbd-client.c
|
|
|
7711c0 |
index 532f90c..eee909f 100644
|
|
|
7711c0 |
--- a/block/nbd-client.c
|
|
|
7711c0 |
+++ b/block/nbd-client.c
|
|
|
7711c0 |
@@ -716,9 +716,7 @@ static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,
|
|
|
7711c0 |
bool received = false;
|
|
|
7711c0 |
|
|
|
7711c0 |
assert(!extent->length);
|
|
|
7711c0 |
- NBD_FOREACH_REPLY_CHUNK(s, iter, handle, s->info.structured_reply,
|
|
|
7711c0 |
- NULL, &reply, &payload)
|
|
|
7711c0 |
- {
|
|
|
7711c0 |
+ NBD_FOREACH_REPLY_CHUNK(s, iter, handle, false, NULL, &reply, &payload) {
|
|
|
7711c0 |
int ret;
|
|
|
7711c0 |
NBDStructuredReplyChunk *chunk = &reply.structured;
|
|
|
7711c0 |
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|