[{"id":1770288,"web_url":"http://patchwork.ozlabs.org/comment/1770288/","msgid":"<cd7f10e4-2e78-5108-f744-eab2babb5965@redhat.com>","list_archive_url":null,"date":"2017-09-18T16:01:45","subject":"Re: [Qemu-devel] [PATCH v2 5/7] block/nbd-client:\n\tnbd_co_send_request: return -EIO if s->quit was set in parallel","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/18/2017 08:59 AM, Vladimir Sementsov-Ogievskiy wrote:\n> It's incorrect to return success rc >= 0 if we skip qio_channel_writev_all()\n> call due to s->quit.\n\nDoes this need to cc: qemu-stable for 2.10.1 (or put another way, can we\ncome up with some scenario of EAGAIN or other handling that would\nactually set s->quit in a parallel coroutine when a client sends out\nmultiple requests at once)?\n\n> \n> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n> ---\n>  block/nbd-client.c | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/block/nbd-client.c b/block/nbd-client.c\n> index f331f08a9a..280147e6a7 100644\n> --- a/block/nbd-client.c\n> +++ b/block/nbd-client.c\n> @@ -189,6 +189,9 @@ static int nbd_co_send_request(BlockDriverState *bs,\n>      }\n>  \n>  err:\n> +    if (rc >= 0 && s->quit) {\n> +        rc = -EIO;\n> +    }\n\nI'm still not convinced this is in the right place.  This fails the\nsend_request regardless of whether we skipped qio_channel_writev_all();\nshouldn't the rc be set only in the case that we actually skipped\nwriting the full command because s->quit was detected at that point in time?\n\n>      if (rc < 0) {\n>          s->quit = true;\n>          s->requests[i].coroutine = NULL;\n>","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>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"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 3xwrkQ6v7lz9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 02:17:18 +1000 (AEST)","from localhost ([::1]:37650 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 1dtyjV-0003er-15\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 12:17:17 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37982)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dtyUq-0007oq-98\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 12:02:11 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dtyUi-0008IG-DJ\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 12:02:08 -0400","from mx1.redhat.com ([209.132.183.28]:58162)\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 1dtyUW-0008Dv-D2; Mon, 18 Sep 2017 12:01:48 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\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 53F70A3962;\n\tMon, 18 Sep 2017 16:01:47 +0000 (UTC)","from [10.10.124.97] (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 03FB36060C;\n\tMon, 18 Sep 2017 16:01:45 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 53F70A3962","To":"Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,\n\tqemu-block@nongnu.org, qemu-devel@nongnu.org","References":"<20170918135935.255591-1-vsementsov@virtuozzo.com>\n\t<20170918135935.255591-6-vsementsov@virtuozzo.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<cd7f10e4-2e78-5108-f744-eab2babb5965@redhat.com>","Date":"Mon, 18 Sep 2017 11:01:45 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170918135935.255591-6-vsementsov@virtuozzo.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"wbh552j6MMcVJt4HMKsVC1rCtSj9IovGW\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tMon, 18 Sep 2017 16:01:47 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v2 5/7] block/nbd-client:\n\tnbd_co_send_request: return -EIO if s->quit was set in parallel","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, pbonzini@redhat.com, den@openvz.org, 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>"}},{"id":1770436,"web_url":"http://patchwork.ozlabs.org/comment/1770436/","msgid":"<be18253e-86a1-3478-f5c0-73061f88423a@redhat.com>","list_archive_url":null,"date":"2017-09-18T19:16:11","subject":"Re: [Qemu-devel] [PATCH v2 5/7] block/nbd-client:\n\tnbd_co_send_request: return -EIO if s->quit was set in parallel","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/18/2017 11:01 AM, Eric Blake wrote:\n> On 09/18/2017 08:59 AM, Vladimir Sementsov-Ogievskiy wrote:\n>> It's incorrect to return success rc >= 0 if we skip qio_channel_writev_all()\n>> call due to s->quit.\n> \n> Does this need to cc: qemu-stable for 2.10.1 (or put another way, can we\n> come up with some scenario of EAGAIN or other handling that would\n> actually set s->quit in a parallel coroutine when a client sends out\n> multiple requests at once)?\n\nAlso, long subject line (longer than 80 columns!).  I'd suggest\nsomething like:\n\nnbd-client: fail with -EIO on early exit of nbd_co_send_request","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>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"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 3xwwjg07vjz9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 05:16:54 +1000 (AEST)","from localhost ([::1]:38468 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 1du1XH-0001eg-Gr\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 15:16:51 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:51844)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1du1Wm-0001dN-9c\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 15:16:21 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1du1Wl-0005zu-66\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 15:16:20 -0400","from mx1.redhat.com ([209.132.183.28]:60886)\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 1du1Wg-0005vF-I5; Mon, 18 Sep 2017 15:16:14 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 6E2E6883B4;\n\tMon, 18 Sep 2017 19:16:13 +0000 (UTC)","from [10.10.124.97] (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 17D215C1A3;\n\tMon, 18 Sep 2017 19:16:11 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 6E2E6883B4","To":"Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,\n\tqemu-block@nongnu.org, qemu-devel@nongnu.org","References":"<20170918135935.255591-1-vsementsov@virtuozzo.com>\n\t<20170918135935.255591-6-vsementsov@virtuozzo.com>\n\t<cd7f10e4-2e78-5108-f744-eab2babb5965@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<be18253e-86a1-3478-f5c0-73061f88423a@redhat.com>","Date":"Mon, 18 Sep 2017 14:16:11 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<cd7f10e4-2e78-5108-f744-eab2babb5965@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"GU12DKOSV2qOuk9aXvLaboaTccoSbTiLI\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tMon, 18 Sep 2017 19:16:13 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v2 5/7] block/nbd-client:\n\tnbd_co_send_request: return -EIO if s->quit was set in parallel","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, pbonzini@redhat.com, mreitz@redhat.com, den@openvz.org","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>"}},{"id":1771907,"web_url":"http://patchwork.ozlabs.org/comment/1771907/","msgid":"<21bf795a-f5af-670a-26f8-1313f36ca8c0@virtuozzo.com>","list_archive_url":null,"date":"2017-09-20T12:03:24","subject":"Re: [Qemu-devel] [PATCH v2 5/7] block/nbd-client:\n\tnbd_co_send_request: return -EIO if s->quit was set in parallel","submitter":{"id":66592,"url":"http://patchwork.ozlabs.org/api/people/66592/","name":"Vladimir Sementsov-Ogievskiy","email":"vsementsov@virtuozzo.com"},"content":"18.09.2017 19:01, Eric Blake wrote:\n> On 09/18/2017 08:59 AM, Vladimir Sementsov-Ogievskiy wrote:\n>> It's incorrect to return success rc >= 0 if we skip qio_channel_writev_all()\n>> call due to s->quit.\n> Does this need to cc: qemu-stable for 2.10.1 (or put another way, can we\n> come up with some scenario of EAGAIN or other handling that would\n> actually set s->quit in a parallel coroutine when a client sends out\n> multiple requests at once)?\n\nIntuitively, I think it should not be possible, first nbd_send_request \nshould not do\nsomething serious (should not yield) after set_cork..\n\n>\n>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>\n>> ---\n>>   block/nbd-client.c | 3 +++\n>>   1 file changed, 3 insertions(+)\n>>\n>> diff --git a/block/nbd-client.c b/block/nbd-client.c\n>> index f331f08a9a..280147e6a7 100644\n>> --- a/block/nbd-client.c\n>> +++ b/block/nbd-client.c\n>> @@ -189,6 +189,9 @@ static int nbd_co_send_request(BlockDriverState *bs,\n>>       }\n>>   \n>>   err:\n>> +    if (rc >= 0 && s->quit) {\n>> +        rc = -EIO;\n>> +    }\n> I'm still not convinced this is in the right place.  This fails the\n> send_request regardless of whether we skipped qio_channel_writev_all();\n> shouldn't the rc be set only in the case that we actually skipped\n> writing the full command because s->quit was detected at that point in time?\n>\n>>       if (rc < 0) {\n>>           s->quit = true;\n>>           s->requests[i].coroutine = NULL;\n>>","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 3xy1zL3wTcz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 00:17:34 +1000 (AEST)","from localhost ([::1]:48383 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 1dufoi-0005Ge-H1\n\tfor incoming@patchwork.ozlabs.org; Wed, 20 Sep 2017 10:17:32 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37068)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vsementsov@virtuozzo.com>) id 1duf2N-0003UF-5F\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:27:36 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <vsementsov@virtuozzo.com>) id 1duf2K-0004du-Sx\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 09:27:35 -0400","from mailhub.sw.ru ([195.214.232.25]:1516 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 1duf28-0004RB-UA; Wed, 20 Sep 2017 09:27:21 -0400","from [172.16.24.243] (msk-vpn.virtuozzo.com [195.214.232.6])\n\tby relay.sw.ru (8.13.4/8.13.4) with ESMTP id v8KC3OTn022245;\n\tWed, 20 Sep 2017 15:03:24 +0300 (MSK)"],"To":"Eric Blake <eblake@redhat.com>, qemu-block@nongnu.org,\n\tqemu-devel@nongnu.org","References":"<20170918135935.255591-1-vsementsov@virtuozzo.com>\n\t<20170918135935.255591-6-vsementsov@virtuozzo.com>\n\t<cd7f10e4-2e78-5108-f744-eab2babb5965@redhat.com>","From":"Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>","Message-ID":"<21bf795a-f5af-670a-26f8-1313f36ca8c0@virtuozzo.com>","Date":"Wed, 20 Sep 2017 15:03:24 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<cd7f10e4-2e78-5108-f744-eab2babb5965@redhat.com>","Content-Language":"en-US","X-detected-operating-system":"by eggs.gnu.org: OpenBSD 3.x [fuzzy]","X-Received-From":"195.214.232.25","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v2 5/7] block/nbd-client:\n\tnbd_co_send_request: return -EIO if s->quit was set in parallel","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, pbonzini@redhat.com, den@openvz.org, 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>"}}]