300-block2mtd_init.patch breaks md raid array autodetection on x86
|Reported by:||Pieter "Fate" Hollants <pieter@…>||Owned by:||developers|
|Priority:||high||Milestone:||Barrier Breaker 14.07|
|Keywords:||md software raid autodetect autodetection rootfs block2mtd||Cc:|
--- Short: ---
md (Software RAID) raid array autodetection is broken since 300_block2mtd_init.patch was copied from olpc into x86's patches-2.6.31 directory due to rootfs being not setup beforehand.
--- Long: ---
In init/main.c's kernel_init(), init/do_mounts_md.c's md_run_setup() is called, which attempts a
create_dev("/dev/md0", MKDEV(MD_MAJOR, 0));
This device node is used to trigger the autodetect code in drivers/md/* by issuing a RAID_AUTORUN ioctl() on it.
However, since x86 was lifted to 2.6.31 and 300_block2mtd_init.patch was introduced in r18333, this create_dev() failed with ENOENT.
This happens because 300_block2mtd_init.patch:
- moves the "*(.initcallrootfs.init)" init call from the INITCALLS #define into a separate INITCALLS_ROOT #define, so the rootfs is no longer initialized in the existing do_initcalls() call in main.c:do_basic_setup().
- does a separate do_initcalls() for INITCALLS_ROOT _after_ calling md_run_setup(), when it should be the other way, ie. md_run_setup() must run _after_ the rootfs init call was made, because otherwise it can't create /dev/md0 as seen above.
The attached patch reverses the order in 300_block2mtd_init.patch accordingly so that md raid array autodetection works again.