Received: from eggs.gnu.org ([2001:4830:134:3::10]:45006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3sJY-0000MM-Pw for qemu-devel@nongnu.org; Mon, 07 Nov 2016 17:22:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3sJY-0001Qa-1o for qemu-devel@nongnu.org; Mon, 07 Nov 2016 17:22:52 -0500 References: <1478551093-32757-1-git-send-email-eblake@redhat.com> From: Max Reitz Message-ID: <943db5df-c9cd-ab0a-2964-0f78188937a1@redhat.com> Date: Mon, 7 Nov 2016 23:22:40 +0100 MIME-Version: 1.0 In-Reply-To: <1478551093-32757-1-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sRj4gn3DuSFRhN11WF5HHuelGx22CGSwh" Subject: Re: [Qemu-devel] [PATCH] nbd: Don't inf-loop on early EOF List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sRj4gn3DuSFRhN11WF5HHuelGx22CGSwh From: Max Reitz To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, pbonzini@redhat.com Message-ID: <943db5df-c9cd-ab0a-2964-0f78188937a1@redhat.com> Subject: Re: [PATCH] nbd: Don't inf-loop on early EOF References: <1478551093-32757-1-git-send-email-eblake@redhat.com> In-Reply-To: <1478551093-32757-1-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 07.11.2016 21:38, Eric Blake wrote: > Commit 7d3123e converted a single read_sync() into a while loop > that assumed that read_sync() would either make progress or give > an error. But when the server hangs up early, the client sees > EOF (a read_sync() of 0) and never makes progress, which in turn > caused qemu-iotest './check -nbd 83' to go into an infinite loop. >=20 > Rework the loop to accomodate reads cut short by EOF. >=20 > Reported-by: Max Reitz > Signed-off-by: Eric Blake > --- > nbd/client.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) Reviewed-by: Max Reitz But what about the server's nbd_negotiate_drop_sync()? It uses pretty much the same code, so it seems susceptible to the same issue (only that we don't have a test for that side). Max --sRj4gn3DuSFRhN11WF5HHuelGx22CGSwh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJYIP6wEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQMW3 CACMg8e3TTT/0nzzLNVgywPdBQ03FoOepBSRjqaL2bOfF0DPL+SpevAigo6rmEE4 1cd+QWLODjXGYepZKUn7h+1zcbvvOeuyYFAH8/oBRxDwWatlZrIlhTOph9Dip/AD SyGOE1hD+Kl5j6ZMGTgW7Agd76u6HrbLdnFRrj5weLtbbCS6TOgZnlGga+eGpa5E xDBxxLBHe2LgdAyHBRfOoue6YvVpvdHsXWSs/Ul11QDTaviJjeZ72nOk0SooskDd DZxWjVd0X2lOExRrPJZqCIa+EWWW+PP/bZEAvM0+OrBANsJft7uO2WNu3mBU86eT b/yekP6wPIUbByUM7qweYb+X =1ZJF -----END PGP SIGNATURE----- --sRj4gn3DuSFRhN11WF5HHuelGx22CGSwh--