All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Sergio Lopez <slp@redhat.com>
Cc: pbonzini@redhat.com, marcandre.lureau@redhat.com, mst@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] io: Implement QIO_CHANNEL_ERR_BROKEN
Date: Fri, 1 Jun 2018 12:50:21 +0100	[thread overview]
Message-ID: <20180601115021.GS3458@redhat.com> (raw)
In-Reply-To: <20180531074601.10647-2-slp@redhat.com>

On Thu, May 31, 2018 at 09:45:59AM +0200, Sergio Lopez wrote:
> QIO_CHANNEL_ERR_BROKEN is used to identify a potentially unrecoverable
> error in the channel, like EPIPE.
> ---
>  include/io/channel.h | 1 +
>  io/channel-file.c    | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/include/io/channel.h b/include/io/channel.h
> index e8cdadb..bbe45f6 100644
> --- a/include/io/channel.h
> +++ b/include/io/channel.h
> @@ -38,6 +38,7 @@ typedef struct QIOChannel QIOChannel;
>  typedef struct QIOChannelClass QIOChannelClass;
>  
>  #define QIO_CHANNEL_ERR_BLOCK -2
> +#define QIO_CHANNEL_ERR_BROKEN -3
>  
>  typedef enum QIOChannelFeature QIOChannelFeature;
>  
> diff --git a/io/channel-file.c b/io/channel-file.c
> index db948ab..a990f67 100644
> --- a/io/channel-file.c
> +++ b/io/channel-file.c
> @@ -124,6 +124,9 @@ static ssize_t qio_channel_file_writev(QIOChannel *ioc,
>          if (errno == EAGAIN) {
>              return QIO_CHANNEL_ERR_BLOCK;
>          }
> +        if (errno == EPIPE) {
> +            return QIO_CHANNEL_ERR_BROKEN;
> +        }
>          if (errno == EINTR) {
>              goto retry;
>          }

I don't see a compelling reason to add this.  EAGAIN needs special
handling because we do not wish to set the "Error **errp" object.
EPIPE can be just handled by callers in the same way as any other
errno value, by closing the connection.

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 :|

  reply	other threads:[~2018-06-01 11:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  7:45 [Qemu-devel] [PATCH 0/3] Avoid retrying on serial_xmit with EPIPE Sergio Lopez
2018-05-31  7:45 ` [Qemu-devel] [PATCH 1/3] io: Implement QIO_CHANNEL_ERR_BROKEN Sergio Lopez
2018-06-01 11:50   ` Daniel P. Berrangé [this message]
2018-05-31  7:46 ` [Qemu-devel] [PATCH 2/3] chardev: On QIO_CHANNEL_ERR_BROKEN set errno to EPIPE Sergio Lopez
2018-05-31  9:48   ` Marc-André Lureau
2018-05-31 11:03     ` Sergio Lopez
2018-06-01 11:51   ` Daniel P. Berrangé
2018-05-31  7:46 ` [Qemu-devel] [PATCH 3/3] hw/char/serial: Don't retry on serial_xmit if errno == EPIPE Sergio Lopez
2018-05-31  9:52   ` Marc-André Lureau
2018-05-31 11:03     ` Sergio Lopez
2018-05-31 11:07       ` Marc-André Lureau
2018-06-01 11:52     ` Daniel P. Berrangé
2018-06-01 12:05       ` Sergio Lopez
2018-06-01 12:16         ` Paolo Bonzini
2018-06-01 12:28           ` Sergio Lopez
2018-06-01 12:31             ` Paolo Bonzini
2018-06-01 12:43             ` Peter Maydell
2018-06-01 16:20               ` Sergio Lopez

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=20180601115021.GS3458@redhat.com \
    --to=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=slp@redhat.com \
    /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.