Received: from eggs.gnu.org ([2001:4830:134:3::10]:60667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chHpy-00074C-Hn for qemu-devel@nongnu.org; Fri, 24 Feb 2017 10:31:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chHpu-0007xd-Ji for qemu-devel@nongnu.org; Fri, 24 Feb 2017 10:31:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1chHpu-0007x1-Dp for qemu-devel@nongnu.org; Fri, 24 Feb 2017 10:31:10 -0500 References: <1486041504-23627-1-git-send-email-den@openvz.org> <871sunzovz.fsf@dusky.pond.sub.org> From: Paolo Bonzini Message-ID: <06eccfa8-6a4e-a892-576a-ac06e61a0e2f@redhat.com> Date: Fri, 24 Feb 2017 16:31:07 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/1] qemu-char: socket backend: disconnect on write error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Markus Armbruster Cc: "Denis V. Lunev" , qemu-devel@nongnu.org, "Michael S. Tsirkin" , Anton Nefedov On 24/02/2017 15:46, Marc-Andr=C3=A9 Lureau wrote: >=20 >>> + if (ret < 0 && errno !=3D EAGAIN) { >>> + if (tcp_chr_read_poll(chr) <=3D 0) { >>> + tcp_chr_disconnect(chr); >>> + return len; >>> >> >> This change breaks a number of assumption in vhost-user code. Until no= w, a >> vhost-user function assumed that dev->vhost_ops would remain as long a= s the >> function is running, so it may call vhost_ops callbacks several time, = which >> may eventually fail to do io, but no crash would occur. The disconnect= ion >> would be handled later with the HUP handler. Now, vhost_ops may be cle= ared >> during a write (chr_disconnect -> CHR_EVENT_CLOSED in >> net_vhost_user_event). This can be randomly reproduced with >> vhost-user-test -p /x86_64/vhost-user/flags-mismatch/subprocess Would it work to call tcp_chr_disconnect from an idle source (and destroy the source on the next connect)? Paolo