On Wed, 27 Apr 2011 17:00:58 +0200 Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> wrote: > On Wednesday, 27. April 2011 12:05:13 NeilBrown wrote: > > > Thanks again for the report. > > > > On reflection over dinner, I think I should move the add_disk right to > > the end just before the mutex_unlock. > > I'm not sure it makes a big practical difference but it will be easier to > > justify. > > > > So if you could test this one instead please that would be great. > > > > The rationale is that as soon as we call add_disk, get_gendisk will > > return the disk rather than coming through to md_probe and blocking on > > the mutex. So we want everything set up properly before calling > > add_disk. > > Unfortunately the kernel oopses now. Attached you'll find screenshots > of the oops. I can bring back the serial console if needed. > > I've double verified with "git diff" that I only have your > latest change in the tree. > > Hope that helps, > Thomas Yes it helps, thanks. I do need to add_disk before I kobject_init_and_add the mddev object otherwise it will try to create something in sysfs in a non-existent directory. So the sysfs stuff needs to come last. Could you try this one please? Thanks, NeilBrown diff --git a/drivers/md/md.c b/drivers/md/md.c index 818313e..9f9fa54 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4335,13 +4335,15 @@ static int md_alloc(dev_t dev, char *name) disk->fops = &md_fops; disk->private_data = mddev; disk->queue = mddev->queue; + blk_queue_flush(mddev->queue, REQ_FLUSH | REQ_FUA); /* Allow extended partitions. This makes the * 'mdp' device redundant, but we can't really * remove it now. */ disk->flags |= GENHD_FL_EXT_DEVT; - add_disk(disk); mddev->gendisk = disk; + add_disk(disk); + error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk_to_dev(disk)->kobj, "%s", "md"); if (error) { @@ -4355,8 +4357,6 @@ static int md_alloc(dev_t dev, char *name) if (mddev->kobj.sd && sysfs_create_group(&mddev->kobj, &md_bitmap_group)) printk(KERN_DEBUG "pointless warning\n"); - - blk_queue_flush(mddev->queue, REQ_FLUSH | REQ_FUA); abort: mutex_unlock(&disks_mutex); if (!error && mddev->kobj.sd) { -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html