All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Corey Bryant <coreyb@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, libvir-list@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 3/4] monitor: Prevent removing fd from set during init
Date: Tue, 16 Oct 2012 22:02:31 -0600	[thread overview]
Message-ID: <507E2DD7.3090702@redhat.com> (raw)
In-Reply-To: <1350410912-2373-1-git-send-email-coreyb@linux.vnet.ibm.com>

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

On 10/16/2012 12:08 PM, Corey Bryant wrote:
> If an fd is added to an fd set via the command line, and it is not
> referenced by another command line option (ie. -drive), then clean
> it up after QEMU initialization is complete.
> 
> Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
> ---
> v3:
>   - This patch was split into it's own patch in v3
>     (eblake@redhat.com, kwolf@redhat.com)
> 
>  monitor.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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

> 
> diff --git a/monitor.c b/monitor.c
> index 5d5de41..0dae7ac 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2105,8 +2105,9 @@ static void monitor_fdset_cleanup(MonFdset *mon_fdset)
>      MonFdsetFd *mon_fdset_fd_next;
>  
>      QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_next) {
> -        if (mon_fdset_fd->removed ||
> -                (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0)) {
> +        if ((mon_fdset_fd->removed ||
> +                (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0)) &&
> +                runstate_is_running()) {

This condition looks sufficient for command line parsing; however, I
have to wonder if there are any long-term ill effects, such as if I
pause a guest, then close an fdset, where qemu keeps the fd open until I
continue the guest.  But thinking a bit more, we never promised that
qemu would close fds right away, but only that it wouldn't leak fds by
closing them whenever qemu thinks it is convenient.

>              close(mon_fdset_fd->fd);
>              g_free(mon_fdset_fd->opaque);
>              QLIST_REMOVE(mon_fdset_fd, next);
> 

-- 
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: 617 bytes --]

  reply	other threads:[~2012-10-17  4:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 18:08 [Qemu-devel] [PATCH v3 3/4] monitor: Prevent removing fd from set during init Corey Bryant
2012-10-17  4:02 ` Eric Blake [this message]
2012-10-18 13:45   ` Corey Bryant

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=507E2DD7.3090702@redhat.com \
    --to=eblake@redhat.com \
    --cc=coreyb@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=libvir-list@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 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.