From patchwork Mon Nov 7 19:26:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9415921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FFBF6048F for ; Mon, 7 Nov 2016 19:26:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E3E228B5E for ; Mon, 7 Nov 2016 19:26:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01B5628BEF; Mon, 7 Nov 2016 19:26:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50B9328B5E for ; Mon, 7 Nov 2016 19:26:45 +0000 (UTC) Received: from localhost ([::1]:56131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3pZ6-00086f-Ij for patchwork-qemu-devel@patchwork.kernel.org; Mon, 07 Nov 2016 14:26:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3pYg-00083X-FD for qemu-devel@nongnu.org; Mon, 07 Nov 2016 14:26:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3pYd-000826-CR for qemu-devel@nongnu.org; Mon, 07 Nov 2016 14:26:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56858) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c3pYd-00081T-5A for qemu-devel@nongnu.org; Mon, 07 Nov 2016 14:26:15 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 426DF3D96C for ; Mon, 7 Nov 2016 19:26:14 +0000 (UTC) Received: from [10.3.116.189] (ovpn-116-189.phx2.redhat.com [10.3.116.189]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA7JQDtW015665; Mon, 7 Nov 2016 14:26:13 -0500 To: Max Reitz , Paolo Bonzini , qemu-devel@nongnu.org References: <1478075542-18904-1-git-send-email-pbonzini@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: Date: Mon, 7 Nov 2016 13:26:13 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 07 Nov 2016 19:26:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [Qemu-devel] [PULL v3 00/30] Misc patches for 2016-10-31 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 11/04/2016 05:02 PM, Max Reitz wrote: >> nbd: Let client skip portions of server reply > > This patch (7d3123e1775) breaks iotest 083 (it hangs somewhere). Adding this breaks the infinite loop: but then fails the assertion, which means read_sync() is returning 0 in our particular test (which sort of makes sense: the test is purposefully truncating the server stream at various points to see how the client reacts). I'm trying to figure out if always treating early EOF as a read error would be sufficient to make things work the way we want in the client. diff --git i/nbd/client.c w/nbd/client.c index 5d94e34..23ad4f1 100644 --- i/nbd/client.c +++ w/nbd/client.c @@ -87,10 +87,11 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size) while (size > 0) { ret = read_sync(ioc, buffer, MIN(65536, size)); if (ret < 0) { goto cleanup; } + assert(ret); assert(ret <= size); size -= ret; } ret = dropped;