All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Aleksey Kuleshov <rndfax@yandex.ru>
Cc: qemu-devel <qemu-devel@nongnu.org>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] Patch 9894dc0cdcc broke something
Date: Thu, 22 Feb 2018 12:15:19 +0000	[thread overview]
Message-ID: <20180222121519.GK9323@redhat.com> (raw)
In-Reply-To: <52841519299484@web28j.yandex.ru>

On Thu, Feb 22, 2018 at 02:38:04PM +0300, Aleksey Kuleshov wrote:
> Hello!
> 
> I hit unexpected disconnections because of this patch:
> 
> commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
> Author: Daniel P. Berrange <berrange@redhat.com>
> Date:   Tue Jan 19 11:14:29 2016 +0000
> 
>     char: convert from GIOChannel to QIOChannel
>     
>     In preparation for introducing TLS support to the TCP chardev
>     backend, convert existing chardev code from using GIOChannel
>     to QIOChannel. This simplifies the chardev code by removing
>     most of the OS platform conditional code for dealing with
>     file descriptor passing.
>     
>     Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
>     Message-Id: <1453202071-10289-3-git-send-email-berrange@redhat.com>
>     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> breaks tcp_chr_read:
> 
> -static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
> +static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
>  {
>      CharDriverState *chr = opaque;
>      TCPCharDriver *s = chr->opaque;
> @@ -2938,9 +2801,7 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
>      if (len > s->max_size)
>          len = s->max_size;
>      size = tcp_chr_recv(chr, (void *)buf, len);
> -    if (size == 0 ||
> -        (size < 0 &&
> -         socket_error() != EAGAIN && socket_error() != EWOULDBLOCK)) {
> +    if (size == 0 || size == -1) {
>          /* connection closed */
>          tcp_chr_disconnect(chr);
>      } else if (size > 0) {
> 
> since tcp_chr_recv returns -1 on blocking:

Actually it did not do that in this patch - tcp_chr_recv returns -2
on blocking when that patch was written.

> 
> static ssize_t tcp_chr_recv(Chardev *chr, char *buf, size_t len)
> {
> ...
>     if (ret == QIO_CHANNEL_ERR_BLOCK) {
>         errno = EAGAIN;
>         ret = -1;
>     } else if (ret == -1) {
>         errno = EIO;
>     }

This was caused by by a later change

  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
    

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

      parent reply	other threads:[~2018-02-22 12:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 11:38 [Qemu-devel] Patch 9894dc0cdcc broke something Aleksey Kuleshov
2018-02-22 11:45 ` Daniel P. Berrangé
2018-02-22 12:03   ` Aleksey Kuleshov
2018-02-22 12:15 ` Daniel P. Berrangé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180222121519.GK9323@redhat.com \
    --to=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rndfax@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.