From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TML6a-0007eT-Po for qemu-devel@nongnu.org; Thu, 11 Oct 2012 11:55:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TML6Z-00056W-Ei for qemu-devel@nongnu.org; Thu, 11 Oct 2012 11:55:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TML6Z-00055Y-6h for qemu-devel@nongnu.org; Thu, 11 Oct 2012 11:55:23 -0400 Message-ID: <5076EBE2.6090909@redhat.com> Date: Thu, 11 Oct 2012 09:55:14 -0600 From: Eric Blake MIME-Version: 1.0 References: <1349878805-16352-1-git-send-email-coreyb@linux.vnet.ibm.com> <1349878805-16352-4-git-send-email-coreyb@linux.vnet.ibm.com> <5075F727.1060608@redhat.com> <5076DB6C.7040003@linux.vnet.ibm.com> In-Reply-To: <5076DB6C.7040003@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig5878ADC89E182199491E5251" Subject: Re: [Qemu-devel] [PATCH v2 3/3] qemu-config: Add new -add-fd command line option 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) --------------enig5878ADC89E182199491E5251 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/11/2012 08:45 AM, Corey Bryant wrote: >> Another missing validation check is for duplicate use. With the monit= or >> command, you ALWAYS have a unique fd (thanks to SCM_RIGHTS). But with= >> the command line, I can type 'qemu -add-fd fd=3D4,set=3D1 -add-fd >> fd=3D4,set=3D2'. Oops - I've now corrupted your set layout, unless yo= u >> validate that every fd requested in -add-fd does not already reside in= >> any existing set. >> >=20 > I don't see this validation check for duplicate use of fd's being > necessary. Like you say below, in the QMP add-fd case we can add the > same fd multiple times. So we should be able to add the same fd > multiple times via the command line. The only difference between QMP > and command line in this case is that the QMP fd is a dup and therefore= > a different number and the command line fd will be the same fd. I'd > prefer to leave this alone unless there's a compelling reason to block > adding of the same fd. There is a compelling reason to prevent duplicates among your sets: qemu_close(). Suppose I add fd 4 into set 1 and 2, and then discard set 2 via monitor commands. Then, when qemu_close() drops the last reference to set 2, it steps through and calls close() on all fds in that set, including fd 4. Oops - now set 1 is invalid, because it is tracking a closed fd. And worse, if qemu then does something else to open a new fd, it will get fd 4 again, and now set 1 will be tracking the WRONG fd. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig5878ADC89E182199491E5251 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/ iQEcBAEBCAAGBQJQduviAAoJEKeha0olJ0NqHV0H/3c7Elm3u1Ztlpzfs9/QH+FI /wr5p92AII47vSVCKAqYJu9J6JHDhZDDTu7sVKqKbTsFzq+ylnB5MaY2AMyTSNWj hbcTof82Rr9zZn8JO2k807KJARvvk4V2/aY2lMjSmc0kwfqIaFYES15mQPfIcydI WccV6spGUPoISiuUtG7mMAP2/RGhB7/A1DuznnILeLyQqcGKWrk62k9j/zebIdmi uH9UQDqCrOWhUrqFuXcQDO6QmhSnSqBujXXpgOLoA0JpP5dSZuSWU1XfzrAoBXP1 YoUxF6i0rqfFkMp2OJMeJuvuv0vdu2A6syEI2doOLgmYrE+7m2DEosvKRw3sAVw= =H03/ -----END PGP SIGNATURE----- --------------enig5878ADC89E182199491E5251--