From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOKqC-0008PB-Sq for qemu-devel@nongnu.org; Wed, 17 Oct 2012 00:02:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOKqB-0005Xz-DG for qemu-devel@nongnu.org; Wed, 17 Oct 2012 00:02:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOKqB-0005W9-4U for qemu-devel@nongnu.org; Wed, 17 Oct 2012 00:02:43 -0400 Message-ID: <507E2DD7.3090702@redhat.com> Date: Tue, 16 Oct 2012 22:02:31 -0600 From: Eric Blake MIME-Version: 1.0 References: <1350410912-2373-1-git-send-email-coreyb@linux.vnet.ibm.com> In-Reply-To: <1350410912-2373-1-git-send-email-coreyb@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig98DDBDB7F9A1B7D1BDACA34A" Subject: Re: [Qemu-devel] [PATCH v3 3/4] monitor: Prevent removing fd from set during init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corey Bryant Cc: kwolf@redhat.com, libvir-list@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig98DDBDB7F9A1B7D1BDACA34A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Corey Bryant > --- > v3: > - This patch was split into it's own patch in v3 > (eblake@redhat.com, kwolf@redhat.com) >=20 > monitor.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Eric Blake >=20 > 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_f= dset) > MonFdsetFd *mon_fdset_fd_next; > =20 > 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 =3D=3D= 0)) { > + if ((mon_fdset_fd->removed || > + (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount =3D=3D= 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); >=20 --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig98DDBDB7F9A1B7D1BDACA34A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQfi3XAAoJEKeha0olJ0Nqxz4IAJVxBQ6qm2KxSHOiQIkSolG/ zt+1MZ5LBjAp45Rg8jtUKXMXk8iwN87Nw+LiyzxhtAKYiK3Sp2j29aO1esKcznN4 a1z6mQnVlJtSSm3BjYJNsN6UayJ4qe+du6ZqreOx7yky6Y8yvmPI0Or8XpUKOyGE MPQj8c7G+6F5n/SbkxDwdqRjubYu/xT62Wr20YOn63Lh6s3SjoB0ykJMo1oELDHS cj4+uVLywCJRUxxTiTeRrEhHaeuzZrrhZ5UM6wNCe3HsC2ZjZQkBYS8aRo3oMfRI TL9bPPxdftxL+lDyOSDcvp9W42g0epKNeIDQa8mpNCThCAqWjL4GKOGbMUb0mu4= =10Xz -----END PGP SIGNATURE----- --------------enig98DDBDB7F9A1B7D1BDACA34A--