From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP8BW-0002fc-PK for qemu-devel@nongnu.org; Wed, 03 Sep 2014 06:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP8BS-0004np-5T for qemu-devel@nongnu.org; Wed, 03 Sep 2014 06:53:06 -0400 Message-ID: <5406F2FE.2090907@redhat.com> Date: Wed, 03 Sep 2014 18:52:46 +0800 From: Jason Wang MIME-Version: 1.0 References: <1409740546-9523-1-git-send-email-mst@redhat.com> In-Reply-To: <1409740546-9523-1-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] vhost_net: cleanup recovery List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Andrey Korolyov , qemu-stable@nongnu.org On 09/03/2014 06:35 PM, Michael S. Tsirkin wrote: > commit aad4dce934649b3a398396fc2a76f215bb194ea4 > vhost_net: start/stop guest notifiers properly > > changed the order of calls for guest notifiers, > but did not recover in the correct (reverse) order. > Fix it up. > > Cc: qemu-stable@nongnu.org > Cc: Andrey Korolyov > Cc: Jason Wang > Signed-off-by: Michael S. Tsirkin > --- > hw/net/vhost_net.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > index ba5d544..3819044 100644 > --- a/hw/net/vhost_net.c > +++ b/hw/net/vhost_net.c > @@ -289,7 +289,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, > BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev))); > VirtioBusState *vbus = VIRTIO_BUS(qbus); > VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); > - int r, i = 0; > + int r, e, i; > > if (!vhost_net_device_endian_ok(dev)) { > error_report("vhost-net does not support cross-endian"); > @@ -317,16 +317,22 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, > r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev); > > if (r < 0) { > - goto err; > + goto err_start; > } > } > > return 0; > > -err: > +err_start: > while (--i >= 0) { > vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev); > } > + e = k->set_guest_notifiers(qbus->parent, total_queues * 2, false); > + if (e < 0) { > + fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e); > + fflush(stderr); > + } > +err: > return r; > } > Acked-by: Jason Wang