qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] Merge NBD client/server int qemu-nbd
Date: Sun, 15 Jun 2008 17:56:18 +0200

Le dimanche 15 juin 2008 à 09:25 -0500, Anthony Liguori a écrit :
> Laurent Vivier wrote:
> > Le samedi 14 juin 2008 à 12:35 -0700, Avi Kivity a écrit :
> >   
> >> Laurent Vivier wrote:
> >>
> >>   
> >>
> >>     
> >>>> It is udev that creates the devices, based on events it receives from 
> >>>> the kernel.  Calling udevsettle after the kernel instructs udev to 
> >>>> 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(). 
> >>>
> >>> 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 ?
> >>>   
> >>>       
> >> For this, it seems like sleep() generates the events, which is a little 
> >> unlikely.  I suggest re-checking this.
> >>     
> >
> > re-checked, no events with sleep() only.
> >
> > events generated with sleep() + open() are:
> >   
> 
> I imagine the sleep() is causing another task to be scheduled (probably 
> the server) which is what ends up generating the event.

No, for me, the open() generates the events:

open() -> blkdev_open() -> do_open() -> rescan_partitions() ->
add_partitions() -> device_add() -> kobject_uevent()

If you remove show_parts() from the main(), the partitions appear only
on the first open on the device, for instance you can run manually
"cmp /dev/nbd0 /dev/zero" after "qemu-nbd --connect=/dev/nbd0 ...".

Laurent
-- 
------------- address@hidden ---------------
"The best way to predict the future is to invent it."
- Alan Kay





reply via email to

[Prev in Thread] Current Thread [Next in Thread]