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

Bug#317062: umount -a hangs in strcmp with 2.6.11/12



On Wed, Jul 06, 2005 at 01:37:58AM +0300, Joey Hess wrote:
> Package: busybox-udeb
> Version: 1:1.00-3
> Severity: important
> Tags: d-i
> 
> On 2.6.11 or 2.6.12 on i386, in d-i, but ONLY if the d-i image is built
> to use initramfs, and not it if uses a regular initrd, when /proc,
> /dev/pts and /dev are mounted, umount -a hangs. strace shows it has
> called umount syscall on each of these; /dev and /dev/pts are busy and
> fail. ltrace shows it spinning in a strcmp loop. gdb shows it hanging in
> mtab_getinfo, looks like the linked list has a loop in it.

I finally got fed up of the workarounds and decided to track this down.
In fact it doesn't look like the linked list has a loop, but rather that
mtab_getinfo just forgets to step its cur pointer if it encounters a
rootfs. Patch follows (untested as yet, but I'm in the process of
testing it now):

diff -u busybox-1.01/debian/changelog busybox-1.01/debian/changelog
--- busybox-1.01/debian/changelog
+++ busybox-1.01/debian/changelog
@@ -1,3 +1,9 @@
+busybox (1:1.01-3.1) UNRELEASED; urgency=low
+
+  * Fix infinite loop in umount -a when encountering a rootfs mount point.
+
+ -- Colin Watson <cjwatson@debian.org>  Fri,  9 Dec 2005 11:14:08 +0000
+
 busybox (1:1.01-3) unstable; urgency=low
 
   * debian/config-deb:
diff -u busybox-1.01/util-linux/umount.c busybox-1.01/util-linux/umount.c
--- busybox-1.01/util-linux/umount.c
+++ busybox-1.01/util-linux/umount.c
@@ -111,6 +111,7 @@
 			} else {
 #if !defined CONFIG_FEATURE_MTAB_SUPPORT
 				if (strcmp(cur->device, "rootfs") == 0) {
+					cur = cur->next;
 					continue;
 				} else if (strcmp(cur->device, "/dev/root") == 0) {
 					/* Adjusts device to be the real root device,

Cheers,

-- 
Colin Watson                                       [cjwatson@debian.org]



Reply to: