[{"id":1767954,"web_url":"http://patchwork.ozlabs.org/comment/1767954/","msgid":"<20170913165902.3d907b10@bahia.lan>","list_archive_url":null,"date":"2017-09-13T14:59:02","subject":"Re: [Qemu-devel] [PATCH] virtio-9p: don't break device on\n\tmarshaling fail","submitter":{"id":69178,"url":"http://patchwork.ozlabs.org/api/people/69178/","name":"Greg Kurz","email":"groug@kaod.org"},"content":"On Wed, 13 Sep 2017 17:16:43 +0300\nJan Dakinevich <jan.dakinevich@gmail.com> wrote:\n\n> Fix regression from commit 8d37de41cab145cbba250a8f1f1372b0a5cdf26f.\n> \n> The situation when pdu_marshal returns an error should be considered\n> valid. At least `v9fs_do_readdir_with_stat' relies on that to place in\n> responce buffer as much data as can fit.\n> \n\nIndeed, that's embarrassing... but since v9fs_do_readdir_with_stat() is the\nonly guy that does that, I'd prefer you send a patch to handle this special\ncase instead of reverting 8d37de41ca. Please add a new transport operation\nfor this.\n\nThanks!\n\n> Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com>\n> ---\n>  hw/9pfs/virtio-9p-device.c | 19 ++-----------------\n>  1 file changed, 2 insertions(+), 17 deletions(-)\n> \n> diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c\n> index 62650b0..c3e5935 100644\n> --- a/hw/9pfs/virtio-9p-device.c\n> +++ b/hw/9pfs/virtio-9p-device.c\n> @@ -146,16 +146,8 @@ static ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_t offset,\n>      V9fsState *s = pdu->s;\n>      V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);\n>      VirtQueueElement *elem = v->elems[pdu->idx];\n> -    ssize_t ret;\n>  \n> -    ret = v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap);\n> -    if (ret < 0) {\n> -        VirtIODevice *vdev = VIRTIO_DEVICE(v);\n> -\n> -        virtio_error(vdev, \"Failed to encode VirtFS reply type %d\",\n> -                     pdu->id + 1);\n> -    }\n> -    return ret;\n> +    return v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, ap);\n>  }\n>  \n>  static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,\n> @@ -164,15 +156,8 @@ static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,\n>      V9fsState *s = pdu->s;\n>      V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);\n>      VirtQueueElement *elem = v->elems[pdu->idx];\n> -    ssize_t ret;\n>  \n> -    ret = v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fmt, ap);\n> -    if (ret < 0) {\n> -        VirtIODevice *vdev = VIRTIO_DEVICE(v);\n> -\n> -        virtio_error(vdev, \"Failed to decode VirtFS request type %d\", pdu->id);\n> -    }\n> -    return ret;\n> +    return v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fmt, ap);\n>  }\n>  \n>  static void virtio_init_in_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,","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 3xslFC0yndz9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 00:59:39 +1000 (AEST)","from localhost ([::1]:42981 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 1ds98Z-0008DV-J0\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 10:59:35 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50828)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1ds98D-0008CP-Ck\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 10:59:14 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1ds98A-0006hg-CF\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 10:59:13 -0400","from 2.mo2.mail-out.ovh.net ([188.165.53.149]:58724)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <groug@kaod.org>) id 1ds98A-0006fj-6Y\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 10:59:10 -0400","from player770.ha.ovh.net (b6.ovh.net [213.186.33.56])\n\tby mo2.mail-out.ovh.net (Postfix) with ESMTP id 27010ABA7F\n\tfor <qemu-devel@nongnu.org>; Wed, 13 Sep 2017 16:59:07 +0200 (CEST)","from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139])\n\t(Authenticated sender: groug@kaod.org)\n\tby player770.ha.ovh.net (Postfix) with ESMTPSA id 397573C0096;\n\tWed, 13 Sep 2017 16:59:03 +0200 (CEST)"],"Date":"Wed, 13 Sep 2017 16:59:02 +0200","From":"Greg Kurz <groug@kaod.org>","To":"Jan Dakinevich <jan.dakinevich@gmail.com>","Message-ID":"<20170913165902.3d907b10@bahia.lan>","In-Reply-To":"<1505312203-6319-1-git-send-email-jan.dakinevich@gmail.com>","References":"<1505312203-6319-1-git-send-email-jan.dakinevich@gmail.com>","X-Mailer":"Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu)","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha1;\n\tboundary=\"Sig_//1PMdsM_+KQ0ieHDQUKrO5u\";\n\tprotocol=\"application/pgp-signature\"","X-Ovh-Tracer-Id":"5168443524291926420","X-VR-SPAMSTATE":"OK","X-VR-SPAMSCORE":"-100","X-VR-SPAMCAUSE":"gggruggvucftvghtrhhoucdtuddrfeelledrgeeggdekiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"188.165.53.149","Subject":"Re: [Qemu-devel] [PATCH] virtio-9p: don't break device on\n\tmarshaling fail","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":"\"Aneesh\n\tKumar K.V\" <aneesh.kumar@linux.vnet.ibm.com>, qemu-devel@nongnu.org, \n\t\"Michael S. Tsirkin\" <mst@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>"}}]