From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Li Qiang <liq3ea@gmail.com>, Jason Wang <jasowang@redhat.com>,
QEMU <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock
Date: Wed, 21 Nov 2018 11:57:18 +0000 [thread overview]
Message-ID: <20181121115718.GN26577@redhat.com> (raw)
In-Reply-To: <CAJ+F1C+FQ8WWkrw3Qup-DzyryZZ3UqHdomjzY=-kfCiHcvLWEw@mail.gmail.com>
On Wed, Nov 21, 2018 at 03:28:29PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Wed, Nov 21, 2018 at 3:22 PM Li Qiang <liq3ea@gmail.com> wrote:
> >
> > The fcntl will change the flags directly, use qemu_set_nonblock()
> > instead.
>
> qemu_set_nonblock() will preserve the existing flags. And on windows,
> it will register the FD to the event loop.
> that's a reasonable thing to do, is this fixing an actual bug?
tap.c is only built with CONFIG_POSIX. Win32 is completely separate
in tap-win32.c. So the event loop reg doesn't apply.
I agree it is good to preserve fcntl flags though, so this patch
looks desirable.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
> >
> > Signed-off-by: Li Qiang <liq3ea@gmail.com>
> > ---
> > net/tap.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/tap.c b/net/tap.c
> > index cc8525f154..e8aadd8d4b 100644
> > --- a/net/tap.c
> > +++ b/net/tap.c
> > @@ -592,7 +592,7 @@ int net_init_bridge(const Netdev *netdev, const char *name,
> > return -1;
> > }
> >
> > - fcntl(fd, F_SETFL, O_NONBLOCK);
> > + qemu_set_nonblock(fd);
> > vnet_hdr = tap_probe_vnet_hdr(fd);
> > s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr);
> >
> > @@ -707,7 +707,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
> > }
> > return;
> > }
> > - fcntl(vhostfd, F_SETFL, O_NONBLOCK);
> > + qemu_set_nonblock(vhostfd);
> > }
> > options.opaque = (void *)(uintptr_t)vhostfd;
> >
> > @@ -791,7 +791,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
> > return -1;
> > }
> >
> > - fcntl(fd, F_SETFL, O_NONBLOCK);
> > + qemu_set_nonblock(fd);
> >
> > vnet_hdr = tap_probe_vnet_hdr(fd);
> >
> > @@ -839,7 +839,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
> > goto free_fail;
> > }
> >
> > - fcntl(fd, F_SETFL, O_NONBLOCK);
> > + qemu_set_nonblock(fd);
> >
> > if (i == 0) {
> > vnet_hdr = tap_probe_vnet_hdr(fd);
> > @@ -887,7 +887,7 @@ free_fail:
> > return -1;
> > }
> >
> > - fcntl(fd, F_SETFL, O_NONBLOCK);
> > + qemu_set_nonblock(fd);
> > vnet_hdr = tap_probe_vnet_hdr(fd);
> >
> > net_init_tap_one(tap, peer, "bridge", name, ifname,
> > --
> > 2.11.0
> >
> >
>
>
> --
> 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:[~2018-11-21 12:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 11:21 [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock Li Qiang
2018-11-21 11:28 ` Marc-André Lureau
2018-11-21 11:34 ` Li Qiang
2018-11-21 11:57 ` Daniel P. Berrangé [this message]
2018-11-21 12:23 ` Michael S. Tsirkin
2018-11-21 14:21 ` Markus Armbruster
2018-11-21 17:30 ` Eric Blake
2018-11-21 17:39 ` Michael S. Tsirkin
2018-11-22 2:22 ` Jason Wang
2019-03-10 11:26 ` Li Qiang
2019-03-11 9:35 ` Jason Wang
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=20181121115718.GN26577@redhat.com \
--to=berrange@redhat.com \
--cc=jasowang@redhat.com \
--cc=liq3ea@gmail.com \
--cc=marcandre.lureau@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).