diff mbox series

[v3] vhost-user: save features if the char dev is closed

Message ID 20190924162044.11414-1-amorenoz@redhat.com
State New
Delegated to: Michael S. Tsirkin
Headers show
Series [v3] vhost-user: save features if the char dev is closed | expand

Commit Message

Adrián Moreno Sept. 24, 2019, 4:20 p.m. UTC
That way the state can be correctly restored when the device is opened
again. This might happen if the backend is restarted.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1738768
Reported-by: Pei Zhang <pezhang@redhat.com>
Fixes: 6ab79a20af3a (do not call vhost_net_cleanup() on running net from char user event)
Cc: ddstreet@canonical.com
Cc: Michael S. Tsirkin <mst@redhat.com>

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
---
 net/vhost-user.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jason Wang Sept. 25, 2019, 4:14 a.m. UTC | #1
On 2019/9/25 上午12:20, Adrian Moreno wrote:
> That way the state can be correctly restored when the device is opened
> again. This might happen if the backend is restarted.
>
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1738768
> Reported-by: Pei Zhang <pezhang@redhat.com>
> Fixes: 6ab79a20af3a (do not call vhost_net_cleanup() on running net from char user event)
> Cc: ddstreet@canonical.com
> Cc: Michael S. Tsirkin <mst@redhat.com>
>
> Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
> ---
>  net/vhost-user.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index 51921de443..014199d600 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -235,6 +235,10 @@ static void chr_closed_bh(void *opaque)
>  
>      s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
>  
> +    if (s->vhost_net) {
> +        s->acked_features = vhost_net_get_acked_features(s->vhost_net);
> +    }
> +
>      qmp_set_link(name, false, &err);
>  
>      qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,


Acked-by: Jason Wang <jasowang@redhat.com>
diff mbox series

Patch

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 51921de443..014199d600 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -235,6 +235,10 @@  static void chr_closed_bh(void *opaque)
 
     s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
 
+    if (s->vhost_net) {
+        s->acked_features = vhost_net_get_acked_features(s->vhost_net);
+    }
+
     qmp_set_link(name, false, &err);
 
     qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,