{"id":1072849,"url":"http://patchwork.ozlabs.org/api/patches/1072849/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20190401140903.19186-5-eblake@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20190401140903.19186-5-eblake@redhat.com>","list_archive_url":null,"date":"2019-04-01T14:08:53","name":"[PULL,04/14] nbd: Permit simple error to NBD_CMD_BLOCK_STATUS","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a4531af0a1a51c4b2d65858a7a903a7ec75a85d1","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/?format=json","name":"Eric Blake","email":"eblake@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20190401140903.19186-5-eblake@redhat.com/mbox/","series":[{"id":100345,"url":"http://patchwork.ozlabs.org/api/series/100345/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=100345","date":"2019-04-01T14:08:49","name":"[PULL,01/14] qemu-img: Report bdrv_block_status failures","version":1,"mbox":"http://patchwork.ozlabs.org/series/100345/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1072849/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1072849/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=209.51.188.17; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 44XvZ30z3Nz9sPj\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  2 Apr 2019 01:17:47 +1100 (AEDT)","from localhost ([127.0.0.1]:35339 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1hAxkv-0002in-3A\n\tfor incoming@patchwork.ozlabs.org; Mon, 01 Apr 2019 10:17:45 -0400","from eggs.gnu.org ([209.51.188.92]:45786)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1hAxcf-0001v4-Gb\n\tfor qemu-devel@nongnu.org; Mon, 01 Apr 2019 10:09:14 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1hAxce-0004jJ-Cv\n\tfor qemu-devel@nongnu.org; Mon, 01 Apr 2019 10:09:13 -0400","from mx1.redhat.com ([209.132.183.28]:38338)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1hAxcb-0004hP-T1; Mon, 01 Apr 2019 10:09:10 -0400","from smtp.corp.redhat.com\n\t(int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2DD812D7E7;\n\tMon,  1 Apr 2019 14:09:09 +0000 (UTC)","from blue.redhat.com (ovpn-116-75.phx2.redhat.com [10.3.116.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 7B1F219C70;\n\tMon,  1 Apr 2019 14:09:08 +0000 (UTC)"],"From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Mon,  1 Apr 2019 09:08:53 -0500","Message-Id":"<20190401140903.19186-5-eblake@redhat.com>","In-Reply-To":"<20190401140903.19186-1-eblake@redhat.com>","References":"<20190401140903.19186-1-eblake@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 2.84 on 10.5.11.23","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tMon, 01 Apr 2019 14:09:09 +0000 (UTC)","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PULL 04/14] nbd: Permit simple error to\n\tNBD_CMD_BLOCK_STATUS","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>,\n\tVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,\n\t\"Richard W . M . Jones\" <rjones@redhat.com>,\n\t\"open list:Network Block Dev...\" <qemu-block@nongnu.org>,\n\tMax Reitz <mreitz@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"The NBD spec is clear that when structured replies are active, a\nsimple error reply is acceptable to any command except for\nNBD_CMD_READ.  However, we were mistakenly requiring structured errors\nfor NBD_CMD_BLOCK_STATUS, and hanging up on a server that gave a\nsimple error (since qemu does not behave as such a server, we didn't\nnotice the problem until now).  Broken since its introduction in\ncommit 78a33ab5 (v2.12).\n\nNoticed while debugging a separate failure reported by nbdkit while\nworking out its initial implementation of BLOCK_STATUS, although it\nturns out that nbdkit also chose to send structured error replies for\nBLOCK_STATUS, so I had to manually provoke the situation by hacking\nqemu's server to send a simple error reply:\n\n| diff --git i/nbd/server.c w/nbd/server.c\n| index fd013a2817a..833288d7c45 100644\n| 00--- i/nbd/server.c\n| +++ w/nbd/server.c\n| @@ -2269,6 +2269,8 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,\n|                                        \"discard failed\", errp);\n|\n|      case NBD_CMD_BLOCK_STATUS:\n| +        return nbd_co_send_simple_reply(client, request->handle, ENOMEM,\n| +                                        NULL, 0, errp);\n|          if (!request->len) {\n|              return nbd_send_generic_reply(client, request->handle, -EINVAL,\n|                                            \"need non-zero length\", errp);\n|\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nAcked-by: Richard W.M. Jones <rjones@redhat.com>\nMessage-Id: <20190325190104.30213-3-eblake@redhat.com>\nReviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n---\n block/nbd-client.c | 4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)","diff":"diff --git a/block/nbd-client.c b/block/nbd-client.c\nindex b37a5963013..a3b70d14004 100644\n--- a/block/nbd-client.c\n+++ b/block/nbd-client.c\n@@ -729,9 +729,7 @@ static int nbd_co_receive_blockstatus_reply(NBDClientSession *s,\n     bool received = false;\n\n     assert(!extent->length);\n-    NBD_FOREACH_REPLY_CHUNK(s, iter, handle, s->info.structured_reply,\n-                            NULL, &reply, &payload)\n-    {\n+    NBD_FOREACH_REPLY_CHUNK(s, iter, handle, false, NULL, &reply, &payload) {\n         int ret;\n         NBDStructuredReplyChunk *chunk = &reply.structured;\n\n","prefixes":["PULL","04/14"]}