qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v2 03/12] vhost-user: wrap some read/write with re


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [RFC v2 03/12] vhost-user: wrap some read/write with retry handling
Date: Fri, 8 Jun 2018 11:53:23 -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:
> Signed-off-by: Marc-André Lureau <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

> ---
>  hw/virtio/vhost-user.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index ca554d4ff1..cc9298792d 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -869,7 +869,10 @@ static void slave_read(void *opaque)
>      iov.iov_base = &hdr;
>      iov.iov_len = VHOST_USER_HDR_SIZE;
>  
> -    size = recvmsg(u->slave_fd, &msgh, 0);
> +    do {
> +        size = recvmsg(u->slave_fd, &msgh, 0);
> +    } while (size < 0 && (errno == EINTR || errno == EAGAIN));
> +
>      if (size != VHOST_USER_HDR_SIZE) {
>          error_report("Failed to read from slave.");
>          goto err;
> @@ -898,7 +901,10 @@ static void slave_read(void *opaque)
>      }
>  
>      /* Read payload */
> -    size = read(u->slave_fd, &payload, hdr.size);
> +    do {
> +        size = read(u->slave_fd, &payload, hdr.size);
> +    } while (size < 0 && (errno == EINTR || errno == EAGAIN));
> +
>      if (size != hdr.size) {
>          error_report("Failed to read payload from slave.");
>          goto err;
> @@ -941,7 +947,10 @@ static void slave_read(void *opaque)
>          iovec[1].iov_base = &payload;
>          iovec[1].iov_len = hdr.size;
>  
> -        size = writev(u->slave_fd, iovec, ARRAY_SIZE(iovec));
> +        do {
> +            size = writev(u->slave_fd, iovec, ARRAY_SIZE(iovec));
> +        } while (size < 0 && (errno == EINTR || errno == EAGAIN));
> +
>          if (size != VHOST_USER_HDR_SIZE + hdr.size) {
>              error_report("Failed to send msg reply to slave.");
>              goto err;
> 



reply via email to

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