From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>,
Paolo Bonzini <pbonzini@redhat.com>,
edgari@xilinx.com, QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH] chardev/char-socket: Properly make qio connections non blocking
Date: Fri, 17 Apr 2020 14:13:59 +0100 [thread overview]
Message-ID: <20200417131359.GC69711@redhat.com> (raw)
In-Reply-To: <CAJ+F1CKCjv6rY3t0Lk9sTUFcop2xgjf=TjmkEGM54AzWCwx-XQ@mail.gmail.com>
On Fri, Apr 17, 2020 at 03:01:09PM +0200, Marc-André Lureau wrote:
> Hi
>
> On Fri, Apr 17, 2020 at 2:38 PM Sai Pavan Boddu
> <sai.pavan.boddu@xilinx.com> wrote:
> >
> > In tcp_chr_sync_read function, there is a possibility of socket
> > disconnection during 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>
> > ---
> > 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..30f2b2b 100644
> > --- a/chardev/char-socket.c
> > +++ b/chardev/char-socket.c
> > @@ -549,11 +549,13 @@ 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);
>
> But here it calls tcp_chr_recv(). And I can't find cleanup there.
> Nevertheless, I think this patch should be harmless.
>
> I'd ask Daniel to have a second look.
I don't see any bug that needs fixing here, and I prefer the current
code as it gives confidence that nothing tcp_chr_disconnect does
will accidentally block.
> > if (size == 0) {
> > /* connection closed */
> > tcp_chr_disconnect(chr);
> > + return 0;
> > }
> > + /* Connection is good */
> > + qio_channel_set_blocking(s->ioc, false, NULL);
> >
> > return size;
> > }
> > --
> > 2.7.4
> >
> >
>
>
> --
> Marc-André Lureau
>
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 :|
next prev parent reply other threads:[~2020-04-17 13:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 12:30 [PATCH] chardev/char-socket: Properly make qio connections non blocking Sai Pavan Boddu
2020-04-17 13:01 ` Marc-André Lureau
2020-04-17 13:13 ` Daniel P. Berrangé [this message]
2020-04-17 13:37 ` Sai Pavan Boddu
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=20200417131359.GC69711@redhat.com \
--to=berrange@redhat.com \
--cc=edgari@xilinx.com \
--cc=marcandre.lureau@gmail.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 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.