From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7bL6-0000sK-J6 for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:23:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7bL5-0000rV-4x for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:23:04 -0400 Received: from [199.232.76.173] (port=58349 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7bL4-0000rP-3K for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:23:02 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:37838) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7bL3-000810-QK for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:23:02 -0400 Subject: Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd From: Laurent Vivier In-Reply-To: <485416D2.9050900@qumranet.com> References: <1213370134.4833.29.camel@frecb07144> <4852B339.5090307@codemonkey.ws> <1213382394.3803.9.camel@frecb07144> <4853FD68.9000308@qumranet.com> <1213470224.3843.11.camel@frecb07144> <485416D2.9050900@qumranet.com> Content-Type: text/plain; charset=utf-8 Date: Sat, 14 Jun 2008 21:21:38 +0200 Message-Id: <1213471298.3843.20.camel@frecb07144> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org Le samedi 14 juin 2008 =C3=A0 12:06 -0700, Avi Kivity a =C3=A9crit : > Laurent Vivier wrote: > > Le samedi 14 juin 2008 =C3=A0 20:18 +0300, Avi Kivity a =C3=A9crit : > > =20 > >> Laurent Vivier wrote: > >> =20 > >>> int timeout =3D 5; > >>> while ((fd =3D open(device, O_RDWR)) =3D=3D -1 && timeout--) > >>> sleep(1); > >>> > >>> Any suggestion ??? > >>> > >>> =20 > >>> =20 > >> /sbin/udevsettle > >> =20 > > > > Why do you think udev is involved at this moment ? > > > > /dev/nbd0 is created when the module is loaded (thus before) and the > > partitions when the partition table is read (from within the open). > > =20 >=20 > It is udev that creates the devices, based on events it receives from=20 > the kernel. Calling udevsettle after the kernel instructs udev to=20 > create the device files will wait until they are actually created. Yes, I agree but the kernel events are generated by the open(), so I think I can't use this to know if I can use open().=20 I've used udevmonitor to see what happen: - without open() -> no events - whith open() whithout sleep() -> no events -> open() + sleep() -> events generated by the partition creation. So, what do I miss ? Laurent --=20 ------------- Laurent.Vivier@bull.net --------------- "The best way to predict the future is to invent it." - Alan Kay