diff options
author | NeilBrown <neilb@suse.de> | 2006-08-05 15:14:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-08-06 11:57:46 -0400 |
commit | f9abd1ace43d6186268856dbec2ebf411218d6ca (patch) | |
tree | 63ab66465c56e8e9fcbbf765f135838171fdd77d /drivers/md/linear.c | |
parent | af2bc7d222c2700ccda060184d7bced7d7cb9fc2 (diff) |
[PATCH] md: Fix a bug that recently crept into md/linear
A recent patch that allowed linear arrays to be reconfigured on-line
allowed in a bug which results in divide by zero - not all
mddev->array_size were converted to conf->array_size.
This patch finished the conversion and fixed the bug.
The offending patch was commit 7c7546ccf6463edbeee8d9aac6de7be1cd80d08a.
Thanks to Simon Kirby <sim@netnation.com> for the bug report.
Cc: Simon Kirby <sim@netnation.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r-- | drivers/md/linear.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index ff83c9b5979e..b99c19c7eb22 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -162,7 +162,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
162 | goto out; | 162 | goto out; |
163 | } | 163 | } |
164 | 164 | ||
165 | min_spacing = mddev->array_size; | 165 | min_spacing = conf->array_size; |
166 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); | 166 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); |
167 | 167 | ||
168 | /* min_spacing is the minimum spacing that will fit the hash | 168 | /* min_spacing is the minimum spacing that will fit the hash |
@@ -171,7 +171,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
171 | * that is larger than min_spacing as use the size of that as | 171 | * that is larger than min_spacing as use the size of that as |
172 | * the actual spacing | 172 | * the actual spacing |
173 | */ | 173 | */ |
174 | conf->hash_spacing = mddev->array_size; | 174 | conf->hash_spacing = conf->array_size; |
175 | for (i=0; i < cnt-1 ; i++) { | 175 | for (i=0; i < cnt-1 ; i++) { |
176 | sector_t sz = 0; | 176 | sector_t sz = 0; |
177 | int j; | 177 | int j; |
@@ -228,7 +228,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
228 | curr_offset = 0; | 228 | curr_offset = 0; |
229 | i = 0; | 229 | i = 0; |
230 | for (curr_offset = 0; | 230 | for (curr_offset = 0; |
231 | curr_offset < mddev->array_size; | 231 | curr_offset < conf->array_size; |
232 | curr_offset += conf->hash_spacing) { | 232 | curr_offset += conf->hash_spacing) { |
233 | 233 | ||
234 | while (i < mddev->raid_disks-1 && | 234 | while (i < mddev->raid_disks-1 && |