diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index f2b30019b1cb..e752332268d2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4297,11 +4297,10 @@ static void md_safemode_timeout(unsigned long data) | |||
4297 | 4297 | ||
4298 | static int start_dirty_degraded; | 4298 | static int start_dirty_degraded; |
4299 | 4299 | ||
4300 | static int do_md_run(mddev_t * mddev) | 4300 | static int md_run(mddev_t *mddev) |
4301 | { | 4301 | { |
4302 | int err; | 4302 | int err; |
4303 | mdk_rdev_t *rdev; | 4303 | mdk_rdev_t *rdev; |
4304 | struct gendisk *disk; | ||
4305 | struct mdk_personality *pers; | 4304 | struct mdk_personality *pers; |
4306 | 4305 | ||
4307 | if (list_empty(&mddev->disks)) | 4306 | if (list_empty(&mddev->disks)) |
@@ -4366,8 +4365,6 @@ static int do_md_run(mddev_t * mddev) | |||
4366 | sysfs_notify_dirent(rdev->sysfs_state); | 4365 | sysfs_notify_dirent(rdev->sysfs_state); |
4367 | } | 4366 | } |
4368 | 4367 | ||
4369 | disk = mddev->gendisk; | ||
4370 | |||
4371 | spin_lock(&pers_lock); | 4368 | spin_lock(&pers_lock); |
4372 | pers = find_pers(mddev->level, mddev->clevel); | 4369 | pers = find_pers(mddev->level, mddev->clevel); |
4373 | if (!pers || !try_module_get(pers->owner)) { | 4370 | if (!pers || !try_module_get(pers->owner)) { |
@@ -4495,21 +4492,32 @@ static int do_md_run(mddev_t * mddev) | |||
4495 | if (mddev->flags) | 4492 | if (mddev->flags) |
4496 | md_update_sb(mddev, 0); | 4493 | md_update_sb(mddev, 0); |
4497 | 4494 | ||
4498 | set_capacity(disk, mddev->array_sectors); | ||
4499 | |||
4500 | md_wakeup_thread(mddev->thread); | 4495 | md_wakeup_thread(mddev->thread); |
4501 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | 4496 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ |
4502 | 4497 | ||
4503 | revalidate_disk(mddev->gendisk); | ||
4504 | md_new_event(mddev); | 4498 | md_new_event(mddev); |
4505 | sysfs_notify_dirent(mddev->sysfs_state); | 4499 | sysfs_notify_dirent(mddev->sysfs_state); |
4506 | if (mddev->sysfs_action) | 4500 | if (mddev->sysfs_action) |
4507 | sysfs_notify_dirent(mddev->sysfs_action); | 4501 | sysfs_notify_dirent(mddev->sysfs_action); |
4508 | sysfs_notify(&mddev->kobj, NULL, "degraded"); | 4502 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
4509 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | ||
4510 | return 0; | 4503 | return 0; |
4511 | } | 4504 | } |
4512 | 4505 | ||
4506 | static int do_md_run(mddev_t *mddev) | ||
4507 | { | ||
4508 | int err; | ||
4509 | |||
4510 | err = md_run(mddev); | ||
4511 | if (err) | ||
4512 | goto out; | ||
4513 | |||
4514 | set_capacity(mddev->gendisk, mddev->array_sectors); | ||
4515 | revalidate_disk(mddev->gendisk); | ||
4516 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | ||
4517 | out: | ||
4518 | return err; | ||
4519 | } | ||
4520 | |||
4513 | static int restart_array(mddev_t *mddev) | 4521 | static int restart_array(mddev_t *mddev) |
4514 | { | 4522 | { |
4515 | struct gendisk *disk = mddev->gendisk; | 4523 | struct gendisk *disk = mddev->gendisk; |