aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Noll <maan@systemlinux.org>2008-07-11 08:02:21 -0400
committerNeil Brown <neilb@suse.de>2008-07-11 08:02:21 -0400
commit80fab1d77b2852711917baa437e4fdab31c21fef (patch)
treeee5fb082245d49780a890c09a3ba23c714fc4359
parentebc243372842a81dddbe00bd047a25b8ee7d8b87 (diff)
md: Simplify restart_array().
Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--drivers/md/md.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9756ea0a19b9..bd1dc72ae522 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3766,40 +3766,25 @@ static int do_md_run(mddev_t * mddev)
3766static int restart_array(mddev_t *mddev) 3766static int restart_array(mddev_t *mddev)
3767{ 3767{
3768 struct gendisk *disk = mddev->gendisk; 3768 struct gendisk *disk = mddev->gendisk;
3769 int err;
3770 3769
3771 /* 3770 /* Complain if it has no devices */
3772 * Complain if it has no devices
3773 */
3774 err = -ENXIO;
3775 if (list_empty(&mddev->disks)) 3771 if (list_empty(&mddev->disks))
3776 goto out; 3772 return -ENXIO;
3777 3773 if (!mddev->pers)
3778 if (mddev->pers) { 3774 return -EINVAL;
3779 err = -EBUSY; 3775 if (!mddev->ro)
3780 if (!mddev->ro) 3776 return -EBUSY;
3781 goto out; 3777 mddev->safemode = 0;
3782 3778 mddev->ro = 0;
3783 mddev->safemode = 0; 3779 set_disk_ro(disk, 0);
3784 mddev->ro = 0; 3780 printk(KERN_INFO "md: %s switched to read-write mode.\n",
3785 set_disk_ro(disk, 0); 3781 mdname(mddev));
3786 3782 /* Kick recovery or resync if necessary */
3787 printk(KERN_INFO "md: %s switched to read-write mode.\n", 3783 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
3788 mdname(mddev)); 3784 md_wakeup_thread(mddev->thread);
3789 /* 3785 md_wakeup_thread(mddev->sync_thread);
3790 * Kick recovery or resync if necessary 3786 sysfs_notify(&mddev->kobj, NULL, "array_state");
3791 */ 3787 return 0;
3792 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
3793 md_wakeup_thread(mddev->thread);
3794 md_wakeup_thread(mddev->sync_thread);
3795 err = 0;
3796 sysfs_notify(&mddev->kobj, NULL, "array_state");
3797
3798 } else
3799 err = -EINVAL;
3800
3801out:
3802 return err;
3803} 3788}
3804 3789
3805/* similar to deny_write_access, but accounts for our holding a reference 3790/* similar to deny_write_access, but accounts for our holding a reference