qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 04/15] coroutine-io: handle zero returns from


From: MORITA Kazutaka
Subject: Re: [Qemu-devel] [PATCH v2 04/15] coroutine-io: handle zero returns from recv
Date: Sat, 17 Sep 2011 15:50:45 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.8 Emacs/22.3 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Fri, 16 Sep 2011 16:25:41 +0200,
Paolo Bonzini wrote:
> 
> When the other side is shutdown, read returns zero (writes return EPIPE).
> In this case, care must be taken to avoid infinite loops.  This error
> was already present in sheepdog.
> 
> Cc: MORITA Kazutaka <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  cutils.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/cutils.c b/cutils.c
> index b302020..295187f 100644
> --- a/cutils.c
> +++ b/cutils.c
> @@ -501,8 +501,11 @@ static int do_sendv_recvv(int sockfd, struct iovec *iov, 
> int len, int offset,
>                  }
>                  break;
>              }
> -            iovlen--, p++;
> +            if (rc == 0) {
> +                break;
> +            }
>              ret += rc;
> +            iovlen--, p++;
>          }
>  #endif
>      }
> @@ -567,6 +570,9 @@ int coroutine_fn qemu_co_sendv(int sockfd, struct iovec 
> *iov,
>              }
>              break;
>          }
> +        if (ret == 0) {
> +            break;
> +        }
>          total += ret, len -= ret;
>      }

When EPIPE is set, write() returns -1 doesn't it?

It looks like qemu_co_recvv() handles a zero return correctly, so I
think this patch is not needed.


Thanks,

Kazutaka



reply via email to

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