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