block till hotplug is done?
Hi,
is there any way to block till all hotplug events are handled/ the hotplug processes terminated?
For example
fdisk
mkfs
fails, because after fdisk create a partition, and the kernel reread the partition table, called hotplug, hotplug called udev and udev created the matching /dev file, all of that might be too slow and mkfs might fail in the mean time.
even
fdisk
sleep 2
mkfs
sometimes failes with machines I'm installing.
so I can either randomly increase the delay everytime the installation fails because the device isn't created in time, or I can create the devices myself with mkdev, which defeats the whole purpose of hotplug and udev. Or - preferable - I would want to wait till something tells me the device is there. some way to sleep till not kernel triggered hotlug process is running any more, that would be nice. does the kernel keep track of it's hotplug processes? is there such a way to wait till they are all done?
(and would that work, if hotplug spawned some child process/daemon, i.e. not wait for the daemon to end?)
Regards, Andreas
Quoted 5 lines · Andreas Jellinghaus
Hi,
is there any way to block till all hotplug events are handled/ the hotplug processes terminated?
while [ "ps | grep /sbin/hotplug | grep -v grep" ]; do sleep 1; done
?
Regards
Harri
Quoted 8 lines · Harald Dunkel
Quoted 5 lines · Andreas Jellinghaus
Hi,
is there any way to block till all hotplug events are handled/ the hotplug processes terminated?
while [ "
ps | grep /sbin/hotplug | grep -v grep" ]; do sleep 1; done
Save a process:
while [ "ps | grep '/sbin/[h]otplug'" ]; do sleep 1; done
Depending on what exactly you're waiting on, you might also try:
while [ ! -b /dev/hdc1 ]; do sleep 1; done
(Assuming you know what device name you're expecting - this may depend on the exact list of things that you want to do - there *might* be a race condition where fdisk has created hd?1 but it's not the *right* one because the media was previously partitioned and fdisk hasn't told the kernel to read the new one yet. YMMV and all that...)
Quoted 8 lines · On Tue, 05 Oct 2004 16:38:08 -0400, [email protected]…
Quoted 7 lines · Harald Dunkel
Quoted 5 lines · Andreas Jellinghaus
Hi,
is there any way to block till all hotplug events are handled/ the hotplug processes terminated?
Quoted 5 lines
Quoted 1 line
while [ "
ps | grep /sbin/hotplug | grep -v grep" ]; do sleep 1; doneSave a process:
while [ "
ps | grep '/sbin/[h]otplug'" ]; do sleep 1; done
Why not sit a script in /etc/dev.d and have that wake up your fsck script by signalling a flag file somewhere or somesuch - I think this is the preferable to do stuff with udev, Greg?
Jon.
Quoted 1 line · Harald Dunkel
while [ "
ps | grep /sbin/hotplug | grep -v grep" ]; do sleep 1; done
wouldn't work in case the hotplug bug uses exec(), right?
Andreas
Quoted 5 lines · Andreas Jellinghaus
Hi,
is there any way to block till all hotplug events are handled/ the hotplug processes terminated?
Quoted 7 lines
For example
fdisk
mkfs
fails, because after fdisk create a partition, and the kernel reread the partition table, called hotplug, hotplug called udev and udev created the matching /dev file, all of that might be too slow and mkfs might fail in the mean time.
You can't wait gracefully (i.e. without sleeping), but you can duplicate udev's work synchronously:
fdisk
udevstart
mkfs
I don't know if this is supposed to work (Greg KH: please comment on this). It _will_ work if sysfs entries are guaranteed to be created before the BLKRRPART ioctl returns.
Signature · 1 line
Alexander E. Patrakov
Quoted 4 lines · Andreas Jellinghaus
Hi,
is there any way to block till all hotplug events are handled/ the hotplug processes terminated?
No. We've been over this many times before. Please read the mailing list archives and look at the /etc/dev.d/ interface for the solution to this.
thanks,
greg k-h