Received: from eggs.gnu.org ([2001:4830:134:3::10]:49549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFwCZ-0001Fa-QC for qemu-devel@nongnu.org; Thu, 23 Jun 2016 00:25:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFwCV-0001Oz-EA for qemu-devel@nongnu.org; Thu, 23 Jun 2016 00:25:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41531) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFwCV-0001Ov-8v for qemu-devel@nongnu.org; Thu, 23 Jun 2016 00:25:11 -0400 Date: Thu, 23 Jun 2016 07:25:05 +0300 From: "Michael S. Tsirkin" Message-ID: <20160623072424-mutt-send-email-mst@redhat.com> References: <1466503372-28334-1-git-send-email-marcandre.lureau@redhat.com> <1466503372-28334-24-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1466503372-28334-24-git-send-email-marcandre.lureau@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 23/24] vhost-user: wait until link is up List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, mukawa@igel.co.jp, yuanhan.liu@linux.intel.com, victork@redhat.com, jonshin@cisco.com On Tue, Jun 21, 2016 at 12:02:51PM +0200, marcandre.lureau@redhat.com wro= te: > From: Marc-Andr=E9 Lureau >=20 > The chardev waits for an initial connection before starting qemu, > vhost-user wants the backend negotiation to be completed. vhost-user is > started in the net_vhost_user_event callback, which is synchronously > called after the socket is connected. >=20 > Signed-off-by: Marc-Andr=E9 Lureau > --- > net/vhost-user.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/net/vhost-user.c b/net/vhost-user.c > index 95ed2d2..bb4a253 100644 > --- a/net/vhost-user.c > +++ b/net/vhost-user.c > @@ -248,7 +248,15 @@ static int net_vhost_user_init(NetClientState *pee= r, const char *device, > s->chr =3D chr; > } > =20 > - qemu_chr_add_handlers(chr, NULL, NULL, net_vhost_user_event, nc[0]= .name); > + do { > + Error *err =3D NULL; > + if (qemu_chr_wait_connected(chr, &err) < 0) { > + error_report_err(err); > + return -1; > + } > + qemu_chr_add_handlers(chr, NULL, NULL, > + net_vhost_user_event, nc[0].name); > + } while (nc->link_down); > =20 > assert(s->vhost_net !=3D NULL); I don't get why this makes sense. Why should vhost user poke at link down at all? > --=20 > 2.7.4