diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index f996d8342a85..5caa421c2367 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2809,9 +2809,12 @@ layout_store(mddev_t *mddev, const char *buf, size_t len) | |||
2809 | int err; | 2809 | int err; |
2810 | if (mddev->pers->reconfig == NULL) | 2810 | if (mddev->pers->reconfig == NULL) |
2811 | return -EBUSY; | 2811 | return -EBUSY; |
2812 | err = mddev->pers->reconfig(mddev, n, -1); | 2812 | mddev->new_layout = n; |
2813 | if (err) | 2813 | err = mddev->pers->reconfig(mddev); |
2814 | if (err) { | ||
2815 | mddev->new_layout = mddev->layout; | ||
2814 | return err; | 2816 | return err; |
2817 | } | ||
2815 | } else { | 2818 | } else { |
2816 | mddev->new_layout = n; | 2819 | mddev->new_layout = n; |
2817 | if (mddev->reshape_position == MaxSector) | 2820 | if (mddev->reshape_position == MaxSector) |
@@ -2884,9 +2887,12 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
2884 | int err; | 2887 | int err; |
2885 | if (mddev->pers->reconfig == NULL) | 2888 | if (mddev->pers->reconfig == NULL) |
2886 | return -EBUSY; | 2889 | return -EBUSY; |
2887 | err = mddev->pers->reconfig(mddev, -1, n); | 2890 | mddev->new_chunk_sectors = n >> 9; |
2888 | if (err) | 2891 | err = mddev->pers->reconfig(mddev); |
2892 | if (err) { | ||
2893 | mddev->new_chunk_sectors = mddev->chunk_sectors; | ||
2889 | return err; | 2894 | return err; |
2895 | } | ||
2890 | } else { | 2896 | } else { |
2891 | mddev->new_chunk_sectors = n >> 9; | 2897 | mddev->new_chunk_sectors = n >> 9; |
2892 | if (mddev->reshape_position == MaxSector) | 2898 | if (mddev->reshape_position == MaxSector) |
@@ -5220,8 +5226,13 @@ static int update_array_info(mddev_t *mddev, mdu_array_info_t *info) | |||
5220 | */ | 5226 | */ |
5221 | if (mddev->pers->reconfig == NULL) | 5227 | if (mddev->pers->reconfig == NULL) |
5222 | return -EINVAL; | 5228 | return -EINVAL; |
5223 | else | 5229 | else { |
5224 | return mddev->pers->reconfig(mddev, info->layout, -1); | 5230 | mddev->new_layout = info->layout; |
5231 | rv = mddev->pers->reconfig(mddev); | ||
5232 | if (rv) | ||
5233 | mddev->new_layout = mddev->layout; | ||
5234 | return rv; | ||
5235 | } | ||
5225 | } | 5236 | } |
5226 | if (info->size >= 0 && mddev->dev_sectors / 2 != info->size) | 5237 | if (info->size >= 0 && mddev->dev_sectors / 2 != info->size) |
5227 | rv = update_size(mddev, (sector_t)info->size * 2); | 5238 | rv = update_size(mddev, (sector_t)info->size * 2); |