diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 21:51:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 21:51:36 -0400 |
commit | 44ce6294d07555c3d313757105fd44b78208407f (patch) | |
tree | 29659bee16a4d7111124c6f41289bc9c11669e70 /drivers/md | |
parent | 497f050c42e46a4b1f6a9bcd8827fa5d97fe1feb (diff) |
Revert "md: improve partition detection in md array"
This reverts commit 5b479c91da90eef605f851508744bfe8269591a0.
Quoth Neil Brown:
"It causes an oops when auto-detecting raid arrays, and it doesn't
seem easy to fix.
The array may not be 'open' when do_md_run is called, so
bdev->bd_disk might be NULL, so bd_set_size can oops.
This whole approach of opening an md device before it has been
assembled just seems to get more and more painful. I think I'm going
to have to come up with something clever to provide both backward
comparability with usage expectation, and sane integration into the
rest of the kernel."
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 26 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.c | 2 |
3 files changed, 21 insertions, 8 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 2901d0c0ee9e..65814b0340cb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3104,7 +3104,6 @@ static int do_md_run(mddev_t * mddev) | |||
3104 | struct gendisk *disk; | 3104 | struct gendisk *disk; |
3105 | struct mdk_personality *pers; | 3105 | struct mdk_personality *pers; |
3106 | char b[BDEVNAME_SIZE]; | 3106 | char b[BDEVNAME_SIZE]; |
3107 | struct block_device *bdev; | ||
3108 | 3107 | ||
3109 | if (list_empty(&mddev->disks)) | 3108 | if (list_empty(&mddev->disks)) |
3110 | /* cannot run an array with no devices.. */ | 3109 | /* cannot run an array with no devices.. */ |
@@ -3332,13 +3331,7 @@ static int do_md_run(mddev_t * mddev) | |||
3332 | md_wakeup_thread(mddev->thread); | 3331 | md_wakeup_thread(mddev->thread); |
3333 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | 3332 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ |
3334 | 3333 | ||
3335 | bdev = bdget_disk(mddev->gendisk, 0); | 3334 | mddev->changed = 1; |
3336 | if (bdev) { | ||
3337 | bd_set_size(bdev, mddev->array_size << 1); | ||
3338 | blkdev_ioctl(bdev->bd_inode, NULL, BLKRRPART, 0); | ||
3339 | bdput(bdev); | ||
3340 | } | ||
3341 | |||
3342 | md_new_event(mddev); | 3335 | md_new_event(mddev); |
3343 | kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE); | 3336 | kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE); |
3344 | return 0; | 3337 | return 0; |
@@ -3460,6 +3453,7 @@ static int do_md_stop(mddev_t * mddev, int mode) | |||
3460 | mddev->pers = NULL; | 3453 | mddev->pers = NULL; |
3461 | 3454 | ||
3462 | set_capacity(disk, 0); | 3455 | set_capacity(disk, 0); |
3456 | mddev->changed = 1; | ||
3463 | 3457 | ||
3464 | if (mddev->ro) | 3458 | if (mddev->ro) |
3465 | mddev->ro = 0; | 3459 | mddev->ro = 0; |
@@ -4599,6 +4593,20 @@ static int md_release(struct inode *inode, struct file * file) | |||
4599 | return 0; | 4593 | return 0; |
4600 | } | 4594 | } |
4601 | 4595 | ||
4596 | static int md_media_changed(struct gendisk *disk) | ||
4597 | { | ||
4598 | mddev_t *mddev = disk->private_data; | ||
4599 | |||
4600 | return mddev->changed; | ||
4601 | } | ||
4602 | |||
4603 | static int md_revalidate(struct gendisk *disk) | ||
4604 | { | ||
4605 | mddev_t *mddev = disk->private_data; | ||
4606 | |||
4607 | mddev->changed = 0; | ||
4608 | return 0; | ||
4609 | } | ||
4602 | static struct block_device_operations md_fops = | 4610 | static struct block_device_operations md_fops = |
4603 | { | 4611 | { |
4604 | .owner = THIS_MODULE, | 4612 | .owner = THIS_MODULE, |
@@ -4606,6 +4614,8 @@ static struct block_device_operations md_fops = | |||
4606 | .release = md_release, | 4614 | .release = md_release, |
4607 | .ioctl = md_ioctl, | 4615 | .ioctl = md_ioctl, |
4608 | .getgeo = md_getgeo, | 4616 | .getgeo = md_getgeo, |
4617 | .media_changed = md_media_changed, | ||
4618 | .revalidate_disk= md_revalidate, | ||
4609 | }; | 4619 | }; |
4610 | 4620 | ||
4611 | static int md_thread(void * arg) | 4621 | static int md_thread(void * arg) |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 1b7130cad21f..97ee870b265d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2063,6 +2063,7 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors) | |||
2063 | */ | 2063 | */ |
2064 | mddev->array_size = sectors>>1; | 2064 | mddev->array_size = sectors>>1; |
2065 | set_capacity(mddev->gendisk, mddev->array_size << 1); | 2065 | set_capacity(mddev->gendisk, mddev->array_size << 1); |
2066 | mddev->changed = 1; | ||
2066 | if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) { | 2067 | if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) { |
2067 | mddev->recovery_cp = mddev->size << 1; | 2068 | mddev->recovery_cp = mddev->size << 1; |
2068 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 2069 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index a72e70ad0975..061375ee6592 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3864,6 +3864,7 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors) | |||
3864 | sectors &= ~((sector_t)mddev->chunk_size/512 - 1); | 3864 | sectors &= ~((sector_t)mddev->chunk_size/512 - 1); |
3865 | mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1; | 3865 | mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1; |
3866 | set_capacity(mddev->gendisk, mddev->array_size << 1); | 3866 | set_capacity(mddev->gendisk, mddev->array_size << 1); |
3867 | mddev->changed = 1; | ||
3867 | if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { | 3868 | if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { |
3868 | mddev->recovery_cp = mddev->size << 1; | 3869 | mddev->recovery_cp = mddev->size << 1; |
3869 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3870 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
@@ -3998,6 +3999,7 @@ static void end_reshape(raid5_conf_t *conf) | |||
3998 | conf->mddev->array_size = conf->mddev->size * | 3999 | conf->mddev->array_size = conf->mddev->size * |
3999 | (conf->raid_disks - conf->max_degraded); | 4000 | (conf->raid_disks - conf->max_degraded); |
4000 | set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1); | 4001 | set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1); |
4002 | conf->mddev->changed = 1; | ||
4001 | 4003 | ||
4002 | bdev = bdget_disk(conf->mddev->gendisk, 0); | 4004 | bdev = bdget_disk(conf->mddev->gendisk, 0); |
4003 | if (bdev) { | 4005 | if (bdev) { |