From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEbBZ-0003Pv-JT for qemu-devel@nongnu.org; Mon, 13 Jul 2015 06:42:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEbBU-0006f8-G8 for qemu-devel@nongnu.org; Mon, 13 Jul 2015 06:42:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEbBU-0006f3-BU for qemu-devel@nongnu.org; Mon, 13 Jul 2015 06:42:04 -0400 Date: Mon, 13 Jul 2015 16:11:49 +0530 From: Amit Shah Message-ID: <20150713104149.GB11699@grmbl.mre> References: <1436775182-67309-1-git-send-email-pyssling@ludd.ltu.se> <55A38FBA.50505@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55A38FBA.50505@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qemu-char: Fix missed data on unix socket List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: liangshunbin@jovaunn.com, qemu-devel@nongnu.org, pyssling@ludd.ltu.se On (Mon) 13 Jul 2015 [12:15:22], Paolo Bonzini wrote: > > > On 13/07/2015 10:13, pyssling@ludd.ltu.se wrote: > > Commit 812c1057 introduced HUP detection on unix and tcp sockets prior > > to a read in tcp_chr_read. This unfortunately broke CloudStack 4.2 > > which relied on the old behaviour where data on a socket was readable > > even if a HUP was present. > > > > On Linux a working solution seems to be to simply check the HUP after > > reading available data, while keeping the original behaviour for windows. > > > > There is then a divergence in behaviour for the two platforms, but this > > seems better than breaking a whole software stack. > > There is no need to do something special on Windows, I think. You can > unconditionally check G_IO_HUP after reading. One nit: > > > - if (size == 0) { > > + if (size == 0 || (size < 0 && cond & G_IO_HUP)) { > > Please put (cond & G_IO_HUP) within parentheses. Also, returning TRUE there isn't right - if the connection ends, we should return FALSE. Amit