diff options
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 442622067cae..8f4c70a53210 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -911,14 +911,16 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) | |||
911 | struct stripe_head *osh, *nsh; | 911 | struct stripe_head *osh, *nsh; |
912 | LIST_HEAD(newstripes); | 912 | LIST_HEAD(newstripes); |
913 | struct disk_info *ndisks; | 913 | struct disk_info *ndisks; |
914 | int err = 0; | 914 | int err; |
915 | struct kmem_cache *sc; | 915 | struct kmem_cache *sc; |
916 | int i; | 916 | int i; |
917 | 917 | ||
918 | if (newsize <= conf->pool_size) | 918 | if (newsize <= conf->pool_size) |
919 | return 0; /* never bother to shrink */ | 919 | return 0; /* never bother to shrink */ |
920 | 920 | ||
921 | md_allow_write(conf->mddev); | 921 | err = md_allow_write(conf->mddev); |
922 | if (err) | ||
923 | return err; | ||
922 | 924 | ||
923 | /* Step 1 */ | 925 | /* Step 1 */ |
924 | sc = kmem_cache_create(conf->cache_name[1-conf->active_name], | 926 | sc = kmem_cache_create(conf->cache_name[1-conf->active_name], |
@@ -3843,6 +3845,8 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) | |||
3843 | { | 3845 | { |
3844 | raid5_conf_t *conf = mddev_to_conf(mddev); | 3846 | raid5_conf_t *conf = mddev_to_conf(mddev); |
3845 | unsigned long new; | 3847 | unsigned long new; |
3848 | int err; | ||
3849 | |||
3846 | if (len >= PAGE_SIZE) | 3850 | if (len >= PAGE_SIZE) |
3847 | return -EINVAL; | 3851 | return -EINVAL; |
3848 | if (!conf) | 3852 | if (!conf) |
@@ -3858,7 +3862,9 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) | |||
3858 | else | 3862 | else |
3859 | break; | 3863 | break; |
3860 | } | 3864 | } |
3861 | md_allow_write(mddev); | 3865 | err = md_allow_write(mddev); |
3866 | if (err) | ||
3867 | return err; | ||
3862 | while (new > conf->max_nr_stripes) { | 3868 | while (new > conf->max_nr_stripes) { |
3863 | if (grow_one_stripe(conf)) | 3869 | if (grow_one_stripe(conf)) |
3864 | conf->max_nr_stripes++; | 3870 | conf->max_nr_stripes++; |