diff options
author | NeilBrown <neilb@suse.de> | 2007-05-23 16:58:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-23 23:14:14 -0400 |
commit | a778b73ff793d34c0082f76110f73a7754915067 (patch) | |
tree | 54bf868afb3375cfdb0d01d6ce9e5eea47395f85 /drivers/md/linear.c | |
parent | ab6085c795a71b6a21afe7469d30a365338add7a (diff) |
md: fix bug with linear hot-add and elsewhere
Adding a drive to a linear array seems to have stopped working, due to changes
elsewhere in md, and insufficient ongoing testing...
So the patch to make linear hot-add work in the first place introduced a
subtle bug elsewhere that interracts poorly with older version of mdadm.
This fixes it all up.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r-- | drivers/md/linear.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index d5ecd2d53046..192741083196 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -139,8 +139,6 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
139 | if (!conf) | 139 | if (!conf) |
140 | return NULL; | 140 | return NULL; |
141 | 141 | ||
142 | mddev->private = conf; | ||
143 | |||
144 | cnt = 0; | 142 | cnt = 0; |
145 | conf->array_size = 0; | 143 | conf->array_size = 0; |
146 | 144 | ||
@@ -232,7 +230,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
232 | * First calculate the device offsets. | 230 | * First calculate the device offsets. |
233 | */ | 231 | */ |
234 | conf->disks[0].offset = 0; | 232 | conf->disks[0].offset = 0; |
235 | for (i=1; i<mddev->raid_disks; i++) | 233 | for (i = 1; i < raid_disks; i++) |
236 | conf->disks[i].offset = | 234 | conf->disks[i].offset = |
237 | conf->disks[i-1].offset + | 235 | conf->disks[i-1].offset + |
238 | conf->disks[i-1].size; | 236 | conf->disks[i-1].size; |
@@ -244,7 +242,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
244 | curr_offset < conf->array_size; | 242 | curr_offset < conf->array_size; |
245 | curr_offset += conf->hash_spacing) { | 243 | curr_offset += conf->hash_spacing) { |
246 | 244 | ||
247 | while (i < mddev->raid_disks-1 && | 245 | while (i < raid_disks-1 && |
248 | curr_offset >= conf->disks[i+1].offset) | 246 | curr_offset >= conf->disks[i+1].offset) |
249 | i++; | 247 | i++; |
250 | 248 | ||
@@ -299,9 +297,11 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev) | |||
299 | */ | 297 | */ |
300 | linear_conf_t *newconf; | 298 | linear_conf_t *newconf; |
301 | 299 | ||
302 | if (rdev->raid_disk != mddev->raid_disks) | 300 | if (rdev->saved_raid_disk != mddev->raid_disks) |
303 | return -EINVAL; | 301 | return -EINVAL; |
304 | 302 | ||
303 | rdev->raid_disk = rdev->saved_raid_disk; | ||
304 | |||
305 | newconf = linear_conf(mddev,mddev->raid_disks+1); | 305 | newconf = linear_conf(mddev,mddev->raid_disks+1); |
306 | 306 | ||
307 | if (!newconf) | 307 | if (!newconf) |