[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH] vhost_net: cleanup recovery
From: |
Jason Wang |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH] vhost_net: cleanup recovery |
Date: |
Wed, 03 Sep 2014 17:20:58 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
On 09/03/2014 05:10 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: address@hidden
> Cc: Andrey Korolyov <address@hidden>
> Cc: Jason Wang <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
> 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..1fe18c7 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, 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);
> }
> +err:
> + r = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
> + if (r < 0) {
> + fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", r);
> + fflush(stderr);
> + }
We probably need a new label, since we only want to do this when guest
notifiers has been set.
> return r;
> }
>