From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7bpV-0006kf-62 for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:54:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7bpU-0006kN-81 for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:54:28 -0400 Received: from [199.232.76.173] (port=33409 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7bpU-0006kK-0d for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:54:28 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:44055) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7bpT-0003x4-Co for qemu-devel@nongnu.org; Sat, 14 Jun 2008 15:54:27 -0400 Subject: Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd From: Laurent Vivier In-Reply-To: <48541D73.7000001@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> <1213471298.3843.20.camel@frecb07144> <48541D73.7000001@qumranet.com> Content-Type: text/plain; charset=UTF-8 Date: Sat, 14 Jun 2008 21:54:22 +0200 Message-Id: <1213473262.15674.6.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:35 -0700, Avi Kivity a =C3=A9crit : > Laurent Vivier wrote: >=20 > =20 >=20 > >> It is udev that creates the devices, based on events it receives fro= m=20 > >> the kernel. Calling udevsettle after the kernel instructs udev to=20 > >> create the device files will wait until they are actually created. > >> =20 > > > > 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 ? > > =20 >=20 > For this, it seems like sleep() generates the events, which is a little= =20 > unlikely. I suggest re-checking this. re-checked, no events with sleep() only. events generated with sleep() + open() are: UEVENT[1213473088.354639] change@/block/nbd0 ACTION=3Dchange DEVPATH=3D/block/nbd0 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D0 DEVTYPE=3Ddisk SEQNUM=3D2921 UEVENT[1213473088.354721] add@/block/nbd0/nbd0p1 ACTION=3Dadd DEVPATH=3D/block/nbd0/nbd0p1 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D1 DEVTYPE=3Dpartition SEQNUM=3D2922 UEVENT[1213473088.354781] add@/block/nbd0/nbd0p2 ACTION=3Dadd DEVPATH=3D/block/nbd0/nbd0p2 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D2 DEVTYPE=3Dpartition SEQNUM=3D2923 UEVENT[1213473088.354842] add@/block/nbd0/nbd0p5 ACTION=3Dadd DEVPATH=3D/block/nbd0/nbd0p5 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D5 DEVTYPE=3Dpartition SEQNUM=3D2924 UDEV [1213473088.355617] change@/block/nbd0 UDEV_LOG=3D3 ACTION=3Dchange DEVPATH=3D/block/nbd0 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D0 DEVTYPE=3Ddisk SEQNUM=3D2921 UDEVD_EVENT=3D1 DEVNAME=3D/dev/nbd0 UDEV [1213473088.356818] add@/block/nbd0/nbd0p1 UDEV_LOG=3D3 ACTION=3Dadd DEVPATH=3D/block/nbd0/nbd0p1 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D1 DEVTYPE=3Dpartition SEQNUM=3D2922 UDEVD_EVENT=3D1 DEVNAME=3D/dev/nbd0p1 UDEV [1213473088.358335] add@/block/nbd0/nbd0p5 UDEV_LOG=3D3 ACTION=3Dadd DEVPATH=3D/block/nbd0/nbd0p5 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D5 DEVTYPE=3Dpartition SEQNUM=3D2924 UDEVD_EVENT=3D1 DEVNAME=3D/dev/nbd0p5 UDEV [1213473088.358390] add@/block/nbd0/nbd0p2 UDEV_LOG=3D3 ACTION=3Dadd DEVPATH=3D/block/nbd0/nbd0p2 SUBSYSTEM=3Dblock MAJOR=3D43 MINOR=3D2 DEVTYPE=3Dpartition SEQNUM=3D2923 UDEVD_EVENT=3D1 DEVNAME=3D/dev/nbd0p2 > There is also some ioctl which can be used to force re-reading the=20 > partition table, perhaps invoking that and then udevsettle will suffice= . Yes, I know that, but to make the ioctl() you need an open()... and the open() is enough. Regards, Laurent --=20 ------------- Laurent.Vivier@bull.net --------------- "The best way to predict the future is to invent it." - Alan Kay