login
Header Space

 
 

Re: Software RAID partitions not detected at boot time with linux 2.6.25.1.

Previous thread: [-mm][PATCH 0/5] mm: page reclaim throttle v6 by KOSAKI Motohiro on Sunday, May 4, 2008 - 8:53 am. (21 messages)

Next thread: Re: i387/FPU init issues... by Sebastian Herbszt on Sunday, May 4, 2008 - 9:08 am. (2 messages)
To: Joao Luis Meloni Assirati <assirati@...>, Kay Sievers <kay.sievers@...>, Greg Kroah-Hartman <gregkh@...>
Cc: <linux-kernel@...>, <linux-raid@...>
Date: Sunday, May 4, 2008 - 8:56 am

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...
To: Neil Brown <neilb@...>
Cc: Joao Luis Meloni Assirati <assirati@...>, Greg Kroah-Hartman <gregkh@...>, <linux-kernel@...>, <linux-raid@...>
Date: Monday, May 5, 2008 - 8:29 am

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 &lt;kay.sievers@vrfy.org&gt;
Subject: block: do_mounts - accept root=&lt;non-existant partition&gt;

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 &lt;kay.sievers@vrfy.org&gt;
---

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(&amp;block_class_lock);
 	list_for_each_entry(dev, &amp;block_class.devices, node) {
 		if (strcmp(dev-&gt;bus_id, name) == 0) {
-			devt = dev-&gt;devt;
+			struct gendisk *disk = dev_to_disk(dev);
+
+			if (part &lt; disk-&gt;minors)
+				devt = MKDEV(MAJOR(dev-&gt;devt),
+					     MINOR(dev-&gt;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);
@...
To: Kay Sievers <kay.sievers@...>
Cc: Neil Brown <neilb@...>, Greg Kroah-Hartman <gregkh@...>, <linux-kernel@...>, <linux-raid@...>
Date: Monday, May 5, 2008 - 2:22 pm

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&lt;sda2&gt;
md: bind&lt;sdb2&gt;
md: bind&lt;sdc2&gt;
md: running: &lt;sdc2&gt;&lt;sdb2&gt;&lt;sda2&gt;
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 &lt; p5 p6 p7 &gt;

I will test it in another machine with raid1 later. If something

Thank you,
--
Previous thread: [-mm][PATCH 0/5] mm: page reclaim throttle v6 by KOSAKI Motohiro on Sunday, May 4, 2008 - 8:53 am. (21 messages)

Next thread: Re: i387/FPU init issues... by Sebastian Herbszt on Sunday, May 4, 2008 - 9:08 am. (2 messages)
speck-geostationary