All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev
@ 2018-02-22 12:13 Daniel P. Berrangé
  2018-02-22 12:35 ` Marc-André Lureau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-02-22 12:13 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Marc-André Lureau, Aleksey Kuleshov,
	Daniel P. Berrangé

When this commit was applied

  commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Tue Jan 19 11:14:29 2016 +0000

    char: convert from GIOChannel to QIOChannel

The tcp_chr_recv() function was changed to return QIO_CHANNEL_ERR_BLOCK
which corresonds to -2. As such the handling for EAGAIN was able to be
removed from tcp_chr_read(). Unfortunately in a later commit:

  commit b6572b4f97a7b126c7b24e165893ed9fe3d72e1f
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Mar 11 18:55:24 2016 +0100

    char: translate from QIOChannel error to errno

The tcp_chr_recv() function was changed back to return -1, with errno
set to EAGAIN, without also re-addding support for this to tcp_chr_read()

Reported-by: Aleksey Kuleshov <rndfax@yandex.ru>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 chardev/char-socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index bdd6cff5f6..b15682c362 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -449,7 +449,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
         len = s->max_size;
     }
     size = tcp_chr_recv(chr, (void *)buf, len);
-    if (size == 0 || size == -1) {
+    if (size == 0 || (size == -1 && errno != EAGAIN)) {
         /* connection closed */
         tcp_chr_disconnect(chr);
     } else if (size > 0) {
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev
  2018-02-22 12:13 [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev Daniel P. Berrangé
@ 2018-02-22 12:35 ` Marc-André Lureau
  2018-02-22 12:43 ` Aleksey Kuleshov
  2018-03-12 14:22 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2018-02-22 12:35 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: QEMU, Paolo Bonzini, Aleksey Kuleshov

On Thu, Feb 22, 2018 at 1:13 PM, Daniel P. Berrangé <berrange@redhat.com> wrote:
> When this commit was applied
>
>   commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
>   Author: Daniel P. Berrange <berrange@redhat.com>
>   Date:   Tue Jan 19 11:14:29 2016 +0000
>
>     char: convert from GIOChannel to QIOChannel
>
> The tcp_chr_recv() function was changed to return QIO_CHANNEL_ERR_BLOCK
> which corresonds to -2. As such the handling for EAGAIN was able to be
> removed from tcp_chr_read(). Unfortunately in a later commit:
>
>   commit b6572b4f97a7b126c7b24e165893ed9fe3d72e1f
>   Author: Marc-André Lureau <marcandre.lureau@redhat.com>
>   Date:   Fri Mar 11 18:55:24 2016 +0100
>
>     char: translate from QIOChannel error to errno
>
> The tcp_chr_recv() function was changed back to return -1, with errno
> set to EAGAIN, without also re-addding support for this to tcp_chr_read()
>
> Reported-by: Aleksey Kuleshov <rndfax@yandex.ru>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  chardev/char-socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index bdd6cff5f6..b15682c362 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -449,7 +449,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
>          len = s->max_size;
>      }
>      size = tcp_chr_recv(chr, (void *)buf, len);
> -    if (size == 0 || size == -1) {
> +    if (size == 0 || (size == -1 && errno != EAGAIN)) {
>          /* connection closed */
>          tcp_chr_disconnect(chr);
>      } else if (size > 0) {
> --
> 2.14.3
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev
  2018-02-22 12:13 [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev Daniel P. Berrangé
  2018-02-22 12:35 ` Marc-André Lureau
@ 2018-02-22 12:43 ` Aleksey Kuleshov
  2018-03-12 14:22 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Aleksey Kuleshov @ 2018-02-22 12:43 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel; +Cc: Paolo Bonzini, Marc-André Lureau

Thank you, Daniel!

22.02.2018, 15:14, "Daniel P. Berrangé" <berrange@redhat.com>:
> When this commit was applied
>
>   commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
>   Author: Daniel P. Berrange <berrange@redhat.com>
>   Date: Tue Jan 19 11:14:29 2016 +0000
>
>     char: convert from GIOChannel to QIOChannel
>
> The tcp_chr_recv() function was changed to return QIO_CHANNEL_ERR_BLOCK
> which corresonds to -2. As such the handling for EAGAIN was able to be
> removed from tcp_chr_read(). Unfortunately in a later commit:
>
>   commit b6572b4f97a7b126c7b24e165893ed9fe3d72e1f
>   Author: Marc-André Lureau <marcandre.lureau@redhat.com>
>   Date: Fri Mar 11 18:55:24 2016 +0100
>
>     char: translate from QIOChannel error to errno
>
> The tcp_chr_recv() function was changed back to return -1, with errno
> set to EAGAIN, without also re-addding support for this to tcp_chr_read()
>
> Reported-by: Aleksey Kuleshov <rndfax@yandex.ru>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  chardev/char-socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index bdd6cff5f6..b15682c362 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -449,7 +449,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
>          len = s->max_size;
>      }
>      size = tcp_chr_recv(chr, (void *)buf, len);
> - if (size == 0 || size == -1) {
> + if (size == 0 || (size == -1 && errno != EAGAIN)) {
>          /* connection closed */
>          tcp_chr_disconnect(chr);
>      } else if (size > 0) {
> --
> 2.14.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev
  2018-02-22 12:13 [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev Daniel P. Berrangé
  2018-02-22 12:35 ` Marc-André Lureau
  2018-02-22 12:43 ` Aleksey Kuleshov
@ 2018-03-12 14:22 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2018-03-12 14:22 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: Marc-André Lureau, Aleksey Kuleshov

On 22/02/2018 13:13, Daniel P. Berrangé wrote:
> When this commit was applied
> 
>   commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
>   Author: Daniel P. Berrange <berrange@redhat.com>
>   Date:   Tue Jan 19 11:14:29 2016 +0000
> 
>     char: convert from GIOChannel to QIOChannel
> 
> The tcp_chr_recv() function was changed to return QIO_CHANNEL_ERR_BLOCK
> which corresonds to -2. As such the handling for EAGAIN was able to be
> removed from tcp_chr_read(). Unfortunately in a later commit:
> 
>   commit b6572b4f97a7b126c7b24e165893ed9fe3d72e1f
>   Author: Marc-André Lureau <marcandre.lureau@redhat.com>
>   Date:   Fri Mar 11 18:55:24 2016 +0100
> 
>     char: translate from QIOChannel error to errno
> 
> The tcp_chr_recv() function was changed back to return -1, with errno
> set to EAGAIN, without also re-addding support for this to tcp_chr_read()
> 
> Reported-by: Aleksey Kuleshov <rndfax@yandex.ru>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  chardev/char-socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index bdd6cff5f6..b15682c362 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -449,7 +449,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
>          len = s->max_size;
>      }
>      size = tcp_chr_recv(chr, (void *)buf, len);
> -    if (size == 0 || size == -1) {
> +    if (size == 0 || (size == -1 && errno != EAGAIN)) {
>          /* connection closed */
>          tcp_chr_disconnect(chr);
>      } else if (size > 0) {
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-12 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 12:13 [Qemu-devel] [PATCH v1] chardev: fix handling of EAGAIN for TCP chardev Daniel P. Berrangé
2018-02-22 12:35 ` Marc-André Lureau
2018-02-22 12:43 ` Aleksey Kuleshov
2018-03-12 14:22 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.