Skip to contentSkip to conversation

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

DISCUSSION Erik Andersen 1 participant 1 message Jul 16, 2003

lore
Share & tools
lore
#0 lore raw

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 controller...

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,
hdb:DMA
    ide1: BM-DMA at 0xfc08-0xfc0f, BIOS settings: hdc:DMA,

hdd: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)
(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

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--