qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, libvir-list@redhat.com,
	Corey Bryant <coreyb@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v4 3/4] monitor: Prevent removing fd from set during init
Date: Thu, 18 Oct 2012 15:19:33 -0400	[thread overview]
Message-ID: <1350587974-6378-4-git-send-email-coreyb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1350587974-6378-1-git-send-email-coreyb@linux.vnet.ibm.com>

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>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
v3:
  - This patch was split into it's own patch in v3
    (eblake@redhat.com, kwolf@redhat.com)

v4:
  - No changes

 monitor.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/monitor.c b/monitor.c
index d8f66ca..928e3ae 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()) {
             close(mon_fdset_fd->fd);
             g_free(mon_fdset_fd->opaque);
             QLIST_REMOVE(mon_fdset_fd, next);
-- 
1.7.11.4

  parent reply	other threads:[~2012-10-18 19:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 19:19 [Qemu-devel] [PATCH v4 0/4] command line fd passing using fd sets Corey Bryant
2012-10-18 19:19 ` [Qemu-devel] [PATCH v4 1/4] monitor: Allow add-fd to any specified fd set Corey Bryant
2012-10-18 19:19 ` [Qemu-devel] [PATCH v4 2/4] monitor: Enable adding an inherited fd to an " Corey Bryant
2012-10-18 19:19 ` Corey Bryant [this message]
2012-10-18 19:19 ` [Qemu-devel] [PATCH v4 4/4] qemu-config: Add new -add-fd command line option Corey Bryant
2012-10-18 20:43   ` Eric Blake
2012-10-18 21:37     ` Corey Bryant
2012-10-19 11:05       ` Kevin Wolf
2012-10-19 13:12         ` Corey Bryant
2012-10-18 22:09   ` Eric Blake
2012-10-22 14:36   ` [Qemu-devel] [PATCH v5] " Kevin Wolf
2012-10-22 15:06     ` 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=1350587974-6378-4-git-send-email-coreyb@linux.vnet.ibm.com \
    --to=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 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).