2.4.22-pre6 race condition during boot hoses up stat("/")?

From: Erik Andersen (andersen@codepoet.org)
Date: Wed Jul 16 2003 - 17:29:15 EST

I recently obtained a P4 and have started building the kernel
with SMP enabled (for hyper-threading). I have started noticing
some sortof wierd race with mounting root with an Intel ICH5 ide

Normally doing a stat("/", &buf) gives me the correct st_rdev for
my root device. But every few boots I find that st_rdev is
instead set to the st_rdev of the last IDE device under /proc/ide
that happens to be using the ide-disk driver..

Busybox has a find_real_root_device_name() function which depends
upon stat("/") giving the correct st_rdev, and this bug causes it
to do wierd things.

So for example, when booting I see this:

PCI: Enabling device 00:1f.1 (0005 -> 0007)
ICH5: chipset revision 2
ICH5: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0xfc00-0xfc07, BIOS settings: hda:DMA,
    ide1: BM-DMA at 0xfc08-0xfc0f, BIOS settings: hdc:DMA,
hda: IC35L080AVVA07-0, ATA DISK drive
hdb: WDC AC32500H, ATA DISK drive

My root_fs is on /dev/hda2.

But when running the debugger I see....

38 if (stat("/", &rootStat) != 0)
(gdb) p rootStat.st_rdev
$1 = 832
(gdb) p (832 >> 8) & 0xff
$2 = 3
(gdb) p 832 & 0xff
$3 = 64

Which works out to major 3, minor 64, or /dev/hdb!!!

I've attempted to track down where such a problem could
occur, but so far I've come up empty.


Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:27 EST