It appears this regression was introduced by commit
edfaa7c36574f1bf09c65ad602412db9da5f96bf
Driver core: convert block from raw kobjects to core devices
Previously, the device name "md_d0p1" would be parsed out as "md_d0"
and partition 1.
md_d0 would be found and the device number of the first partition
could then be deduced even though the partition table hadn't been
processed at this point, so 'p1' wasn't actually known.
The kernel would attempt to open 'p1', this would trigger a read of
the partition table and the open would be successful.
The new code is 'simpler'. It doesn't try to parse the device name at
all. It just compares the device name against the names of all known
devices. As the partitions are not known at this time, md_d0p1 is not
found.
There seem to be two ways this could be fixed:
1/ restore the old behaviour of parsing out the partition information.
This would be least likely to leave other regressions waiting to be
found, but might be seen as somewhat ugly.
2/ Get md_d0 to read it's partition table earlier. I've tried this
before without much luck.
There are three times that the partition table can be parsed.
a/ When the device is opened if bd_invalidated is set.
b/ When the device is first registered. register_disk calls
blkdev_get which effectively opens the device, thus triggering
'a' above.
c/ When the BLKRRPART ioctl is made on the device.
When an md device is first registered, there are no disks attached
to it, so no partition table can be read. The way md devices get
set up, they are registered as empty devices, the component devices
are attached, then the array is 'started'. Only at this point can
data, such as the partition table, be read. But this it too late
for case 'b' above. Case 'a' is the one that usually causes
partitions to be read. 'mdadm' explicitly opens devices after
creating them to trigger this.
We could conceivably put a BLKRRPART call in at th...Care to test/fix/improve the following. I just booted a normal disk,
didn't test a partitioned md device.
Thanks,
Kay
From: Kay Sievers <kay.sievers@vrfy.org>
Subject: block: do_mounts - accept root=<non-existant partition>
Some devices, like md, may create partitions only at first access,
so allow root= to be set to a valid non-existant partition of an
existing disk. This applies only to non-initramfs root mounting.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
---
diff --git a/block/genhd.c b/block/genhd.c
index fda9c7a..129ad93 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -653,7 +653,7 @@ void genhd_media_change_notify(struct gendisk *disk)
EXPORT_SYMBOL_GPL(genhd_media_change_notify);
#endif /* 0 */
-dev_t blk_lookup_devt(const char *name)
+dev_t blk_lookup_devt(const char *name, int part)
{
struct device *dev;
dev_t devt = MKDEV(0, 0);
@@ -661,7 +661,11 @@ dev_t blk_lookup_devt(const char *name)
mutex_lock(&block_class_lock);
list_for_each_entry(dev, &block_class.devices, node) {
if (strcmp(dev->bus_id, name) == 0) {
- devt = dev->devt;
+ struct gendisk *disk = dev_to_disk(dev);
+
+ if (part < disk->minors)
+ devt = MKDEV(MAJOR(dev->devt),
+ MINOR(dev->devt) + part);
break;
}
}
@@ -669,7 +673,6 @@ dev_t blk_lookup_devt(const char *name)
return devt;
}
-
EXPORT_SYMBOL(blk_lookup_devt);
struct gendisk *alloc_disk(int minors)
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index ecd2bf6..612a790 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -524,7 +524,7 @@ struct unixware_disklabel {
#define ADDPART_FLAG_RAID 1
#define ADDPART_FLAG_WHOLEDISK 2
-extern dev_t blk_lookup_devt(const char *name);
+extern dev_t blk_lookup_devt(const char *name, int part);
extern char *disk_name (struct gendisk *hd, int part, char *buf);
extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
@...It works!: md: Autodetecting RAID arrays. md: Scanned 3 and added 3 devices. md: autorun ... md: considering sdc2 ... md: adding sdc2 ... md: adding sdb2 ... md: adding sda2 ... md: created md_d0 md: bind<sda2> md: bind<sdb2> md: bind<sdc2> md: running: <sdc2><sdb2><sda2> raid5: device sdc2 operational as raid disk 2 raid5: device sdb2 operational as raid disk 1 raid5: device sda2 operational as raid disk 0 raid5: allocated 3224kB for md_d0 raid5: raid level 5 set md_d0 active with 3 out of 3 devices, algorithm 2 RAID5 conf printout: --- rd:3 wd:3 disk 0, o:1, dev:sda2 disk 1, o:1, dev:sdb2 disk 2, o:1, dev:sdc2 md: ... autorun DONE. md_d0: p1 p2 p3 p4 < p5 p6 p7 > I will test it in another machine with raid1 later. If something Thank you, --
| Alex Samad | page swap allocation error/failure in 2.6.25 |
| Bart Van Assche | Re: Integration of SCST in the mainstream Linux kernel |
| Andrea Arcangeli | [PATCH 06 of 11] rwsem contended |
| Chuck Ebbert | Why do so many machines need "noapic"? |
git: | |
| Andy Parkins | svn:externals using git submodules |
| Elijah Newren | Trying to use git-filter-branch to compress history by removing large, obsolete bi... |
| Marcus Griep | [PATCH] git-svn: Make it scream by minimizing temp files |
| Tommi Virtanen | [PATCH] "git shell" won't work, need "git-shell" |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Theo de Raadt | Re: Chatting with developers? Is it soo 1996? |
| Ted Unangst | Re: MAXDSIZ 1GB memory limit for process |
| Richard Stallman | Real men don't attack straw men |
| Denys Fedoryshchenko | Re: thousands of classes, e1000 TX unit hang |
| Suresh Siddha | Re: Kernel oops with 2.6.26, padlock and ipsec: probably problem with fpu state ch... |
| Simon Horman | Re: [PATCH] sendfile() and UDP socket |
| Jeff Garzik | Re: [PATCH] sky2: jumbo frame regression fix |
