Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814950/?format=api
{ "id": 814950, "url": "http://patchwork.ozlabs.org/api/patches/814950/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918135935.255591-8-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": "<20170918135935.255591-8-vsementsov@virtuozzo.com>", "list_archive_url": null, "date": "2017-09-18T13:59:35", "name": "[v2,7/7] block/nbd-client: do not yield from nbd_read_reply_entry", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ff11114f0bca13e378eeb5057924e778ffb24933", "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/20170918135935.255591-8-vsementsov@virtuozzo.com/mbox/", "series": [ { "id": 3654, "url": "http://patchwork.ozlabs.org/api/series/3654/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3654", "date": "2017-09-18T13:59:31", "name": "nbd client refactoring and fixing", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/3654/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814950/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814950/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=2001:4830:134:3::11; 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 [IPv6:2001:4830:134:3::11])\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 3xwnlz45Ylz9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 00:03:27 +1000 (AEST)", "from localhost ([::1]:36799 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 1dtwdx-0004a5-LX\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 10:03:25 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:38436)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vsementsov@virtuozzo.com>) id 1dtwaR-0001iK-9i\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:59:48 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <vsementsov@virtuozzo.com>) id 1dtwaN-0001QL-Me\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:59:47 -0400", "from mailhub.sw.ru ([195.214.232.25]:10237 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 1dtwaN-0001Pg-B7\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 09:59:43 -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 v8IDxZdb022049;\n\tMon, 18 Sep 2017 16:59:37 +0300 (MSK)" ], "From": "Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>", "To": "qemu-block@nongnu.org, qemu-devel@nongnu.org", "Date": "Mon, 18 Sep 2017 16:59:35 +0300", "Message-Id": "<20170918135935.255591-8-vsementsov@virtuozzo.com>", "X-Mailer": "git-send-email 2.11.1", "In-Reply-To": "<20170918135935.255591-1-vsementsov@virtuozzo.com>", "References": "<20170918135935.255591-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 v2 7/7] block/nbd-client: do not yield from\n\tnbd_read_reply_entry", "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": "Refactor nbd client to not yield from nbd_read_reply_entry. It's\npossible now as all reading is done in nbd_read_reply_entry and\nall request-related data is stored in per-request s->requests[i].\n\nWe need here some additional work with s->requests[i].ret and\ns->quit to not fail requests on normal disconnet and to not report\nreading errors on normal disconnect.\n\nSigned-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n---\n block/nbd-client.c | 29 ++++++++++-------------------\n 1 file changed, 10 insertions(+), 19 deletions(-)", "diff": "diff --git a/block/nbd-client.c b/block/nbd-client.c\nindex f80a4c5564..bf20d5d5e6 100644\n--- a/block/nbd-client.c\n+++ b/block/nbd-client.c\n@@ -79,7 +79,11 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)\n while (!s->quit) {\n ret = nbd_receive_reply(s->ioc, &reply, &local_err);\n if (ret < 0) {\n- error_report_err(local_err);\n+ if (s->quit) {\n+ error_free(local_err);\n+ } else {\n+ error_report_err(local_err);\n+ }\n }\n if (ret <= 0 || s->quit) {\n break;\n@@ -112,19 +116,8 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)\n }\n }\n \n- /* We're woken up again by the request itself. Note that there\n- * is no race between yielding and reentering read_reply_co. This\n- * is because:\n- *\n- * - if the request runs on the same AioContext, it is only\n- * entered after we yield\n- *\n- * - if the request runs on a different AioContext, reentering\n- * read_reply_co happens through a bottom half, which can only\n- * run after we yield.\n- */\n+ s->requests[i].receiving = false;\n aio_co_wake(s->requests[i].coroutine);\n- qemu_coroutine_yield();\n }\n \n s->quit = true;\n@@ -157,6 +150,7 @@ static int nbd_co_send_request(BlockDriverState *bs,\n \n s->requests[i].coroutine = qemu_coroutine_self();\n s->requests[i].receiving = false;\n+ s->requests[i].ret = -EIO;\n \n request->handle = INDEX_TO_HANDLE(s, i);\n s->requests[i].request = request;\n@@ -210,7 +204,7 @@ static int nbd_co_receive_reply(NBDClientSession *s, NBDRequest *request)\n s->requests[i].receiving = true;\n qemu_coroutine_yield();\n s->requests[i].receiving = false;\n- if (!s->ioc || s->quit) {\n+ if (!s->ioc) {\n ret = -EIO;\n } else {\n ret = s->requests[i].ret;\n@@ -218,11 +212,6 @@ static int nbd_co_receive_reply(NBDClientSession *s, NBDRequest *request)\n \n s->requests[i].coroutine = NULL;\n \n- /* Kick the read_reply_co to get the next reply. */\n- if (s->read_reply_co) {\n- aio_co_wake(s->read_reply_co);\n- }\n-\n qemu_co_mutex_lock(&s->send_mutex);\n s->in_flight--;\n qemu_co_queue_next(&s->free_sema);\n@@ -364,6 +353,8 @@ void nbd_client_close(BlockDriverState *bs)\n \n nbd_send_request(client->ioc, &request);\n \n+ client->quit = true;\n+\n nbd_teardown_connection(bs);\n }\n \n", "prefixes": [ "v2", "7/7" ] }