qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	david.pravec@nethost.cz, Juan Quintela <quintela@redhat.com>,
	mprivozn@redhat.com, coreyb@linux.vnet.ibm.com,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 0/4] monitor: do not rely on O_NONBLOCK for passed file descriptors
Date: Wed, 27 Mar 2013 05:48:19 -0600	[thread overview]
Message-ID: <5152DC83.60009@redhat.com> (raw)
In-Reply-To: <1364375446-24180-1-git-send-email-stefanha@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

On 03/27/2013 03:10 AM, Stefan Hajnoczi wrote:
> There are several places where QEMU accidentally relies on the O_NONBLOCK state
> of passed file descriptors.  Exposing O_NONBLOCK state makes it part of the QMP
> API whenever getfd or fdset_add_fd are used!
> 
> Whether or not QEMU will use O_NONBLOCK is an implementation detail and should
> be hidden from QMP clients.
> 
> This patch series addresses this in 3 steps:
> 
> 1. Fix callers of monitor_handle_fd_param(), monitor_fdset_get_fd(), and
>    monitor_get_fd() that depend on O_NONBLOCK being set.  Luckily there are
>    only two instances and they are fixed in Patches 1 & 2.

Description is now off after rebase, but the cover letter isn't
committed, so no big deal.

> 
> 2. Rename socket_set_nonblock() to qemu_set_nonblock() just like
>    qemu_set_cloexec().  This makes code cleaner when working with arbitrary
>    file descriptors that may not be sockets.  See Patch 3.
> 
> 3. Clear O_NONBLOCK when a chardev receives file descriptors.  From now on QEMU
>    can assume that passed file descriptors are in blocking mode.  Simply use
>    qemu_set_nonblock(fd) if you want to enable O_NONBLOCK.  See Patch 4.

Series: Reviewed-by: Eric Blake <eblake@redhat.com>

> v2:
>  * Rename socket_set_nonblock() in Patch 1 to avoid code churn [eblake]
>  * Avoid qemu_set_block(-1) calls that clobber errno [quintela]
> 
> Stefan Hajnoczi (4):
>   oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
>   net: ensure "socket" backend uses non-blocking fds
>   qemu-socket: set passed fd non-blocking in socket_connect()
>   chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  parent reply	other threads:[~2013-03-27 11:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27  9:10 [Qemu-devel] [PATCH v2 0/4] monitor: do not rely on O_NONBLOCK for passed file descriptors Stefan Hajnoczi
2013-03-27  9:10 ` [Qemu-devel] [PATCH v2 1/4] oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock() Stefan Hajnoczi
2013-03-27  9:10 ` [Qemu-devel] [PATCH v2 2/4] net: ensure "socket" backend uses non-blocking fds Stefan Hajnoczi
2013-03-27  9:10 ` [Qemu-devel] [PATCH v2 3/4] qemu-socket: set passed fd non-blocking in socket_connect() Stefan Hajnoczi
2013-03-27  9:10 ` [Qemu-devel] [PATCH v2 4/4] chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors Stefan Hajnoczi
2013-03-27 11:48 ` Eric Blake [this message]
2013-03-27 13:17 ` [Qemu-devel] [PATCH v2 0/4] monitor: do not rely on O_NONBLOCK for passed " Luiz Capitulino
2013-04-03 15:05   ` mdroth
2013-04-03 15:24     ` Luiz Capitulino
2013-04-03 15:31       ` Luiz Capitulino

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=5152DC83.60009@redhat.com \
    --to=eblake@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=coreyb@linux.vnet.ibm.com \
    --cc=david.pravec@nethost.cz \
    --cc=lcapitulino@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@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 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).