Bug#394193: initramfs-tools: root file system fails to mount when mounting by a label, on top of an md device.

Neil Brown neilb at suse.de
Mon Oct 23 04:38:52 CEST 2006


On Friday October 20, md at Linux.IT wrote:
> On Oct 20, maximilian attems <maks at sternwelten.at> wrote:
> 
> > On Fri, 20 Oct 2006, Chris Andrews wrote:
> > > At this point there are no /dev/disk/by-label enteries for the md devices,
> > > and running a udevtrigger will populate it. 
> No, this is wrong. DO NOT run udevtrigger for no good reason.
> If you need to trigger a specific event then tickle $DEVPATH/uevent,
> e.g:
> 
> echo add > /sys/block/md0/uevent
> 
> But still, I can't see why this should help: if /sys/block/md0/ exists
> then the MD array has already been activated, so its uevent should have
> been generated too.

No.  /sys/block/md0 gets created *before* the array is fully
functional.
First /sys/block/md0 is created
then the array is assembled.
then the array is started and becomes functional.

I realise this is confusing for udev and I have been looking into the
problem, but it is not clear what the best solution is.

One possibility is the following patch.  It sends online/offline
events at the appropriate times.  Would that make udev sufficiently
happy?

NeilBrown



-----------------------
Send online/offline uevents when an md array starts/stops.

This allows udev to do something intellegent when an
array becomes available.

Signed-off-by: Neil Brown <neilb at suse.de>

### Diffstat output
 ./drivers/md/md.c |    2 ++
 1 file changed, 2 insertions(+)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c	2006-09-29 11:04:13.000000000 +1000
+++ ./drivers/md/md.c	2006-09-28 14:50:00.000000000 +1000
@@ -3194,6 +3194,7 @@ static int do_md_run(mddev_t * mddev)
 
 	mddev->changed = 1;
 	md_new_event(mddev);
+	kobject_uevent(&mddev->gendisk->kobj, KOBJ_ONLINE);
 	return 0;
 }
 
@@ -3355,6 +3356,7 @@ static int do_md_stop(mddev_t * mddev, i
 		if (disk)
 			set_capacity(disk, 0);
 		mddev->changed = 1;
+		kobject_uevent(&mddev->gendisk->kobj, KOBJ_OFFLINE);
 	} else if (mddev->pers)
 		printk(KERN_INFO "md: %s switched to read-only mode.\n",
 			mdname(mddev));




More information about the pkg-mdadm-devel mailing list