summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-10-11 14:24:13 +1100
committerNeilBrown <neilb@suse.de>2012-10-11 14:24:13 +1100
commite56108d65f8705170d238858616728359542aebb (patch)
treeebb300a8d901cdad3c160575a72e813dc5709728 /drivers/md
parentdb07d85ef6395d4768c6cdceeb2ea4878bd2a3f4 (diff)
downloadblackbird-op-linux-e56108d65f8705170d238858616728359542aebb.tar.gz
blackbird-op-linux-e56108d65f8705170d238858616728359542aebb.zip
md/raid5: be careful not to resize_stripes too big.
When a RAID5 is reshaping, conf->raid_disks is increased before mddev->delta_disks becomes zero. This can result in check_reshape calling resize_stripes with a number that is too large. This particularly happens when md_check_recovery calls ->check_reshape(). If we use ->previous_raid_disks, we don't risk this. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4cc6b0e398bc..2737247d2a02 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5871,7 +5871,8 @@ static int check_reshape(struct mddev *mddev)
if (!check_stripe_cache(mddev))
return -ENOSPC;
- return resize_stripes(conf, conf->raid_disks + mddev->delta_disks);
+ return resize_stripes(conf, (conf->previous_raid_disks
+ + mddev->delta_disks));
}
static int raid5_start_reshape(struct mddev *mddev)
OpenPOWER on IntegriCloud