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

Bug#603944: Updated patch



Here is a patch (against the ubuntu package, just as example)
which instead of doing a dumb retry loop, waits for udev.

=== modified file 'debian/changelog'
--- debian/changelog	2010-04-26 15:17:47 +0000
+++ debian/changelog	2010-12-08 21:44:32 +0000
@@ -1,3 +1,15 @@
+initramfs-tools (0.92bubuntu79) natty; urgency=low
+
+  * When using multipath, it is possible that mountroot() will race
+    with udev's renaming of /dev/disk/by-uuid/{rootfs-uuid} from
+    /dev/sd?? to /dev/mapper/something.  After multipath has grabbed
+    the /dev/sd?? and until udev completes the rename, mounting
+    /dev/disk/by-uuid/{rootfs-uuid} will fail with -EBUSY.  In that
+    case, call 'udevsettle' to wait until udev has finished all its
+    related actions. (Closes LP: #686832)
+
+ -- Serge Hallyn <serge.hallyn@ubuntu.com>  Fri, 19 Nov 2010 12:19:43 -0600
+
 initramfs-tools (0.92bubuntu78) lucid; urgency=low
 
   * hooks/compcache: Escape $-expansions inside <<EOF (thanks, Eugene San;

=== modified file 'scripts/local'
--- scripts/local	2009-12-21 23:06:53 +0000
+++ scripts/local	2010-11-20 01:03:26 +0000
@@ -69,10 +69,19 @@
 	# FIXME This has no error checking
 	[ -n "${FSTYPE}" ] && modprobe ${FSTYPE}
 
-	# FIXME This has no error checking
 	# Mount root
-	mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
-	mountroot_status="$?"
+	tries=0
+	ret=1
+	while [ $tries -lt 2 -a $ret -ne 0 ]; do
+		mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
+		ret=$?
+		if [ $ret -ne 0 ]; then
+			echo "failed attempt $tries to mount $ROOT as root"
+			udevadm settle
+			tries=$((tries+1))
+		fi
+	done
+	mountroot_status=$ret
 	if [ "$LOOP" ]; then
 		if [ "$mountroot_status" != 0 ]; then
 			if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then




Reply to: