qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	edgari@xilinx.com, qemu-devel@nongnu.org,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v2] chardev/char-socket: Properly make qio connections non blocking
Date: Mon, 20 Apr 2020 10:26:00 +0100	[thread overview]
Message-ID: <20200420092600.GG346737@redhat.com> (raw)
In-Reply-To: <1587289900-29485-1-git-send-email-sai.pavan.boddu@xilinx.com>

On Sun, Apr 19, 2020 at 03:21:40PM +0530, Sai Pavan Boddu wrote:
> In tcp_chr_sync_read function, there is a possibility of socket
> disconnection during blocking read, then tcp_chr_hup function would clean up
> the qio channel pointers(i.e ioc, sioc).
> 
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
> ---
> Changes for V2:
> 	Place the guard around 'qio_channel_set_blocking' call to check connection status
> 	This fix is simpler than v1 and explains better about the issue.
> 
>  chardev/char-socket.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index 185fe38..e56b2f0 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -549,7 +549,9 @@ static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
>  
>      qio_channel_set_blocking(s->ioc, true, NULL);
>      size = tcp_chr_recv(chr, (void *) buf, len);
> -    qio_channel_set_blocking(s->ioc, false, NULL);
> +    if (s->state != TCP_CHARDEV_STATE_DISCONNECTED) {
> +        qio_channel_set_blocking(s->ioc, false, NULL);
> +    }
>      if (size == 0) {
>          /* connection closed */
>          tcp_chr_disconnect(chr);

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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:[~2020-04-20  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19  9:51 [PATCH v2] chardev/char-socket: Properly make qio connections non blocking Sai Pavan Boddu
2020-04-20  9:26 ` Daniel P. Berrangé [this message]
2020-04-25 10:46   ` Paolo Bonzini

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=20200420092600.GG346737@redhat.com \
    --to=berrange@redhat.com \
    --cc=edgari@xilinx.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sai.pavan.boddu@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).