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/md.c | |
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/md.c')
-rw-r--r-- | drivers/md/md.c | 26 |
1 files changed, 18 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) |