Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/797894/?format=api
{ "id": 797894, "url": "http://patchwork.ozlabs.org/api/patches/797894/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170804151440.320927-15-vsementsov@virtuozzo.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "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": "<20170804151440.320927-15-vsementsov@virtuozzo.com>", "list_archive_url": null, "date": "2017-08-04T15:14:37", "name": "[14/17] block/nbd-client: exit reply-reading coroutine on incorrect handle", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "873b4ded8bf8600a05c7b4ef6d25bb79bd1a7f56", "submitter": { "id": 66592, "url": "http://patchwork.ozlabs.org/api/people/66592/?format=api", "name": "Vladimir Sementsov-Ogievskiy", "email": "vsementsov@virtuozzo.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170804151440.320927-15-vsementsov@virtuozzo.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/797894/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/797894/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=208.118.235.17; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [208.118.235.17])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xPBks2hwLz9sRg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 5 Aug 2017 02:11:49 +1000 (AEST)", "from localhost ([::1]:51840 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 1ddfCV-0000Q5-2h\n\tfor incoming@patchwork.ozlabs.org; Fri, 04 Aug 2017 12:11:47 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:54632)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vsementsov@virtuozzo.com>) id 1ddeJN-0005UM-4U\n\tfor qemu-devel@nongnu.org; Fri, 04 Aug 2017 11:14:51 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <vsementsov@virtuozzo.com>) id 1ddeJL-0007DV-4W\n\tfor qemu-devel@nongnu.org; Fri, 04 Aug 2017 11:14:48 -0400", "from mailhub.sw.ru ([195.214.232.25]:15385 helo=relay.sw.ru)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <vsementsov@virtuozzo.com>)\n\tid 1ddeJK-0007Ac-JY\n\tfor qemu-devel@nongnu.org; Fri, 04 Aug 2017 11:14:46 -0400", "from kvm.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6])\n\tby relay.sw.ru (8.13.4/8.13.4) with ESMTP id v74FEeGI003061;\n\tFri, 4 Aug 2017 18:14:41 +0300 (MSK)" ], "From": "Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>", "To": "qemu-block@nongnu.org, qemu-devel@nongnu.org", "Date": "Fri, 4 Aug 2017 18:14:37 +0300", "Message-Id": "<20170804151440.320927-15-vsementsov@virtuozzo.com>", "X-Mailer": "git-send-email 2.11.1", "In-Reply-To": "<20170804151440.320927-1-vsementsov@virtuozzo.com>", "References": "<20170804151440.320927-1-vsementsov@virtuozzo.com>", "X-detected-operating-system": "by eggs.gnu.org: OpenBSD 3.x [fuzzy]", "X-Received-From": "195.214.232.25", "Subject": "[Qemu-devel] [PATCH 14/17] block/nbd-client: exit reply-reading\n\tcoroutine on incorrect handle", "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": "kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com,\n\tden@openvz.org, pbonzini@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": "Check reply-handle == request-handle in the same place, where\nrecv coroutine number is calculated from reply->handle and it's\ncorrectness checked - in nbd_read_reply_entry.\n\nAlso finish nbd_read_reply_entry in case of reply-handle !=\nrequest-handle in the same way as in case of incorrect reply-handle.\n\nSigned-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n---\n block/nbd-client.h | 1 +\n block/nbd-client.c | 9 +++++++--\n 2 files changed, 8 insertions(+), 2 deletions(-)", "diff": "diff --git a/block/nbd-client.h b/block/nbd-client.h\nindex 48e2559df6..aa36be8950 100644\n--- a/block/nbd-client.h\n+++ b/block/nbd-client.h\n@@ -29,6 +29,7 @@ typedef struct NBDClientSession {\n \n struct {\n Coroutine *co;\n+ NBDRequest *request;\n } requests[MAX_NBD_REQUESTS];\n NBDReply reply;\n } NBDClientSession;\ndiff --git a/block/nbd-client.c b/block/nbd-client.c\nindex 5eb126c399..0e12db4be3 100644\n--- a/block/nbd-client.c\n+++ b/block/nbd-client.c\n@@ -88,7 +88,9 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)\n * one coroutine is called until the reply finishes.\n */\n i = HANDLE_TO_INDEX(s, s->reply.handle);\n- if (i >= MAX_NBD_REQUESTS || !s->requests[i].co) {\n+ if (i >= MAX_NBD_REQUESTS || !s->requests[i].co ||\n+ s->reply.handle != s->requests[i].request->handle)\n+ {\n break;\n }\n \n@@ -135,6 +137,7 @@ static int nbd_co_request(BlockDriverState *bs,\n g_assert(qemu_in_coroutine());\n assert(i < MAX_NBD_REQUESTS);\n request->handle = INDEX_TO_HANDLE(s, i);\n+ s->requests[i].request = request;\n \n if (!s->ioc) {\n qemu_co_mutex_unlock(&s->send_mutex);\n@@ -170,11 +173,13 @@ static int nbd_co_request(BlockDriverState *bs,\n \n /* Wait until we're woken up by nbd_read_reply_entry. */\n qemu_coroutine_yield();\n- if (s->reply.handle != request->handle || !s->ioc) {\n+ if (!s->ioc || s->reply.handle == 0) {\n rc = -EIO;\n goto out;\n }\n \n+ assert(s->reply.handle == request->handle);\n+\n if (qiov && s->reply.error == 0) {\n ret = nbd_rwv(s->ioc, qiov->iov, qiov->niov, request->len, true, NULL);\n if (ret != request->len) {\n", "prefixes": [ "14/17" ] }