qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v2 02/12] libvhost-user: exit by default on VHOST_


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [RFC v2 02/12] libvhost-user: exit by default on VHOST_USER_NONE
Date: Fri, 8 Jun 2018 11:48:39 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 06/01/2018 01:27 PM, Marc-André Lureau wrote:
> Since commit 2566378d6d13bf4d28c7770bdbda5f7682594bbe, libvhost-user
> no longer panics on disconnect (rc == 0), and instead silently ignores
> an invalid VHOST_USER_NONE message.
> 
> Without extra work from the API user, this will simply busy-loop on
> HUP events. The obvious thing to do is to exit(0) instead, while
> additional or different work can be done by overriding
> iface->process_msg().
> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  contrib/libvhost-user/libvhost-user.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/contrib/libvhost-user/libvhost-user.c 
> b/contrib/libvhost-user/libvhost-user.c
> index 54e643d871..ebe30c7dab 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -1220,6 +1220,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)
>      case VHOST_USER_SET_CONFIG:
>          return vu_set_config(dev, vmsg);
>      case VHOST_USER_NONE:
> +        /* if you need processing before exit, override iface->process_msg */
> +        exit(0);
>          break;

Remove the 'break'?

>      case VHOST_USER_POSTCOPY_ADVISE:
>          return vu_set_postcopy_advise(dev, vmsg);
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]