From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Zihan Yang <whois.zihan.yang@gmail.com>
Cc: qemu-devel@nongnu.org,
Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>,
Liu Yuan <namei.unix@gmail.com>, Jeff Cody <jcody@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
"Richard W.M. Jones" <rjones@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"open list:Sheepdog" <qemu-block@nongnu.org>,
"open list:Sheepdog" <sheepdog@lists.wpkg.org>
Subject: Re: [Qemu-devel] [RFC 2/4] qemu-socket: Allow custom socket options in socket_connect
Date: Wed, 31 Jan 2018 09:51:18 +0000 [thread overview]
Message-ID: <20180131095118.GE3255@redhat.com> (raw)
In-Reply-To: <1517253224-14361-3-git-send-email-whois.zihan.yang@gmail.com>
On Tue, Jan 30, 2018 at 03:13:42AM +0800, Zihan Yang wrote:
> Currently, socket_connect doesn't allow custom socket options,
> which is inconvenient when the caller wants a different kind of
> socket from that the socket_connect provides. This patch allows
> custom config in socket_connect by providing an extra parameter.
> Existing functions can just pass a NULL pointer.
Again adding options functionality hwich is not actually used
is bad.
The O_NONBLOCK functionality makes more sense in this context
but the implementation is really broken.
These functions do hostname lookups, so can never do non-blocking
mode correctly as the hostname lookup itself does blocking I/O
to the nameserver(s). Ignoring that, the way you handle the
connect() is wrong too. You're iterating over many addresses
returned by getaddrinfo() and doing a non-blocking connect
on each of them. These will essentially all fail with EAGAIN
and you'll skip onto the next address which is wrong.
This code used to have support for O_NONBLOCK but it was removed
because the DNS problem means that any code relying on it was
already broken. The rest of the QEMU codebase has been converted
to use QIOChannelSocket instead which can handle non-blocking
DNS properly
So overall I'm against this patch too.
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:[~2018-01-31 9:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-29 19:13 [Qemu-devel] [RFC 0/4] Allow custom socket option in socket_listen and socket_connect Zihan Yang
2018-01-29 19:13 ` [Qemu-devel] [RFC 1/4] qemu-socket: Allow custom socket option in socket_listen Zihan Yang
2018-01-31 9:47 ` Daniel P. Berrangé
2018-01-29 19:13 ` [Qemu-devel] [RFC 2/4] qemu-socket: Allow custom socket options in socket_connect Zihan Yang
2018-01-31 9:51 ` Daniel P. Berrangé [this message]
2018-01-31 15:20 ` [Qemu-devel] Fwd: " Zihan Yang
2018-01-31 15:26 ` Daniel P. Berrangé
2018-01-29 19:13 ` [Qemu-devel] [RFC 3/4] net/socket: change net_socket_listen_init to use functions in include/qemu/sockets.h Zihan Yang
2018-01-29 19:13 ` [Qemu-devel] [RFC 4/4] net/socket: change net_socket_connect_init to use functions in sockets.h Zihan Yang
2018-01-29 19:47 ` [Qemu-devel] [RFC 0/4] Allow custom socket option in socket_listen and socket_connect no-reply
2018-01-29 20:19 ` no-reply
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=20180131095118.GE3255@redhat.com \
--to=berrange@redhat.com \
--cc=jcody@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=mitake.hitoshi@lab.ntt.co.jp \
--cc=mreitz@redhat.com \
--cc=namei.unix@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=sheepdog@lists.wpkg.org \
--cc=whois.zihan.yang@gmail.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).