public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* block till hotplug is done?
@ 2004-10-05 19:52 Andreas Jellinghaus
  2004-10-05 20:13 ` Harald Dunkel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Jellinghaus @ 2004-10-05 19:52 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: block till hotplug is done?
  2004-10-05 19:52 block till hotplug is done? Andreas Jellinghaus
@ 2004-10-05 20:13 ` Harald Dunkel
  2004-10-05 20:38   ` Valdis.Kletnieks
  2004-10-05 22:04   ` Andreas Jellinghaus
  2004-10-06 14:19 ` Alexander E. Patrakov
  2004-10-08 14:23 ` Greg KH
  2 siblings, 2 replies; 7+ messages in thread
From: Harald Dunkel @ 2004-10-05 20:13 UTC (permalink / raw)
  To: Andreas Jellinghaus; +Cc: linux-kernel

Andreas Jellinghaus wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: block till hotplug is done?
  2004-10-05 20:13 ` Harald Dunkel
@ 2004-10-05 20:38   ` Valdis.Kletnieks
  2004-10-05 22:16     ` Jon Masters
  2004-10-05 22:04   ` Andreas Jellinghaus
  1 sibling, 1 reply; 7+ messages in thread
From: Valdis.Kletnieks @ 2004-10-05 20:38 UTC (permalink / raw)
  To: Harald Dunkel; +Cc: Andreas Jellinghaus, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On Tue, 05 Oct 2004 22:13:15 +0200, Harald Dunkel said:
> Andreas Jellinghaus wrote:
> > 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...)

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: block till hotplug is done?
  2004-10-05 20:13 ` Harald Dunkel
  2004-10-05 20:38   ` Valdis.Kletnieks
@ 2004-10-05 22:04   ` Andreas Jellinghaus
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Jellinghaus @ 2004-10-05 22:04 UTC (permalink / raw)
  To: linux-kernel

On Tue, 05 Oct 2004 20:19:59 +0000, Harald Dunkel wrote:
> while [ "`ps | grep /sbin/hotplug | grep -v grep`" ]; do sleep 1; done

wouldn't work in case the hotplug bug uses exec(), right?

Andreas


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: block till hotplug is done?
  2004-10-05 20:38   ` Valdis.Kletnieks
@ 2004-10-05 22:16     ` Jon Masters
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Masters @ 2004-10-05 22:16 UTC (permalink / raw)
  To: valdis.kletnieks@vt.edu; +Cc: Harald Dunkel, Andreas Jellinghaus, linux-kernel

On Tue, 05 Oct 2004 16:38:08 -0400, valdis.kletnieks@vt.edu
<valdis.kletnieks@vt.edu> wrote:
> On Tue, 05 Oct 2004 22:13:15 +0200, Harald Dunkel said:
> > Andreas Jellinghaus wrote:
> > > 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

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: block till hotplug is done?
  2004-10-05 19:52 block till hotplug is done? Andreas Jellinghaus
  2004-10-05 20:13 ` Harald Dunkel
@ 2004-10-06 14:19 ` Alexander E. Patrakov
  2004-10-08 14:23 ` Greg KH
  2 siblings, 0 replies; 7+ messages in thread
From: Alexander E. Patrakov @ 2004-10-06 14:19 UTC (permalink / raw)
  To: linux-kernel

Andreas Jellinghaus wrote:
> 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.

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.

-- 
Alexander E. Patrakov


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: block till hotplug is done?
  2004-10-05 19:52 block till hotplug is done? Andreas Jellinghaus
  2004-10-05 20:13 ` Harald Dunkel
  2004-10-06 14:19 ` Alexander E. Patrakov
@ 2004-10-08 14:23 ` Greg KH
  2 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-10-08 14:23 UTC (permalink / raw)
  To: Andreas Jellinghaus; +Cc: linux-kernel

On Tue, Oct 05, 2004 at 09:52:07PM +0200, Andreas Jellinghaus wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-08 14:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-05 19:52 block till hotplug is done? Andreas Jellinghaus
2004-10-05 20:13 ` Harald Dunkel
2004-10-05 20:38   ` Valdis.Kletnieks
2004-10-05 22:16     ` Jon Masters
2004-10-05 22:04   ` Andreas Jellinghaus
2004-10-06 14:19 ` Alexander E. Patrakov
2004-10-08 14:23 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox