r7433 - in branches/udev_update/bootscripts: . lfs/init.d

matthew at linuxfromscratch.org matthew at linuxfromscratch.org
Wed Mar 15 12:43:02 PST 2006


Author: matthew
Date: 2006-03-15 13:43:01 -0700 (Wed, 15 Mar 2006)
New Revision: 7433

Modified:
   branches/udev_update/bootscripts/CHANGELOG
   branches/udev_update/bootscripts/lfs/init.d/udev
Log:
Wait for uevents to be processed by udev

Modified: branches/udev_update/bootscripts/CHANGELOG
===================================================================
--- branches/udev_update/bootscripts/CHANGELOG	2006-03-15 20:30:23 UTC (rev 7432)
+++ branches/udev_update/bootscripts/CHANGELOG	2006-03-15 20:43:01 UTC (rev 7433)
@@ -1,3 +1,7 @@
+n/a - March 15, 2006
+	* Wait for uevents to be processed in the udev script.  See ticket #1720
+	  for details
+
 n/a - March 10, 2006
 	* Moved src argument to ipv4-static-route service script and 
           removed from ipv4-static service script. (DJ Lucas)

Modified: branches/udev_update/bootscripts/lfs/init.d/udev
===================================================================
--- branches/udev_update/bootscripts/lfs/init.d/udev	2006-03-15 20:30:23 UTC (rev 7432)
+++ branches/udev_update/bootscripts/lfs/init.d/udev	2006-03-15 20:43:01 UTC (rev 7433)
@@ -15,6 +15,33 @@
 . /etc/sysconfig/rc
 . ${rc_functions}
 
+wait_for_uevents() {
+	# until we know how to do better, just wait for _all_ events to finish
+	loop=300
+	confirm=0
+	while true ; do
+		sleep 0.1
+		test -d /dev/.udev/queue && confirm=0 || \
+		confirm=$(( $confirm + 1 ))
+		loop=$(( $loop - 1 ))
+		test $loop -gt 0 || break
+		test $confirm -lt 60 || break
+	done
+	test "$loop" -gt 0
+	evaluate_retval
+	sleep 6
+	if test -s /dev/bug; then
+		mv /dev/bug /dev/bugreport
+		boot_mesg "Please paste the /dev/bugreport file to" ${WARNING}
+		boot_mesg "http://wiki.linuxfromscratch.org/lfs/ticket/1720"
+		boot_mesg "Otherwise, the next version of LFS may be unbootable on your system!"
+		echo_failure
+		sleep 10
+	else
+		rm -f /dev/bug
+	fi 
+}
+
 walk_sysfs() {
 	# generate events with the sysfs trigger
 	list=$(echo /sys/bus/*/devices/*/uevent)
@@ -96,8 +123,13 @@
 
 		# Now traverse /sys in order to "coldplug" devices that have
 		# already been discovered
+		mkdir -p /dev/.udev/queue
 		walk_sysfs
 
+		# More uevents may have been triggered during the walk of sysfs,
+		# so wait until they've been processed.
+		wait_for_uevents
+
 		(exit ${failed})
 		evaluate_retval
 		;;




More information about the lfs-book mailing list