diff options
-rw-r--r-- | drivers/md/md.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index ff9fef389608..32b2ad88a2f9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2594,15 +2594,20 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) | |||
2594 | err = do_md_stop(mddev, 1); | 2594 | err = do_md_stop(mddev, 1); |
2595 | else { | 2595 | else { |
2596 | mddev->ro = 1; | 2596 | mddev->ro = 1; |
2597 | set_disk_ro(mddev->gendisk, 1); | ||
2597 | err = do_md_run(mddev); | 2598 | err = do_md_run(mddev); |
2598 | } | 2599 | } |
2599 | break; | 2600 | break; |
2600 | case read_auto: | 2601 | case read_auto: |
2601 | /* stopping an active array */ | ||
2602 | if (mddev->pers) { | 2602 | if (mddev->pers) { |
2603 | err = do_md_stop(mddev, 1); | 2603 | if (mddev->ro != 1) |
2604 | if (err == 0) | 2604 | err = do_md_stop(mddev, 1); |
2605 | mddev->ro = 2; /* FIXME mark devices writable */ | 2605 | else |
2606 | err = restart_array(mddev); | ||
2607 | if (err == 0) { | ||
2608 | mddev->ro = 2; | ||
2609 | set_disk_ro(mddev->gendisk, 0); | ||
2610 | } | ||
2606 | } else { | 2611 | } else { |
2607 | mddev->ro = 2; | 2612 | mddev->ro = 2; |
2608 | err = do_md_run(mddev); | 2613 | err = do_md_run(mddev); |
@@ -2640,6 +2645,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) | |||
2640 | err = 0; | 2645 | err = 0; |
2641 | } else { | 2646 | } else { |
2642 | mddev->ro = 0; | 2647 | mddev->ro = 0; |
2648 | set_disk_ro(mddev->gendisk, 0); | ||
2643 | err = do_md_run(mddev); | 2649 | err = do_md_run(mddev); |
2644 | } | 2650 | } |
2645 | break; | 2651 | break; |