From: NeilBrown Date: Tue, 25 Sep 2012 07:00:43 +0000 (+1000) Subject: md/raid5: be careful not to resize_stripes too big. X-Git-Tag: next-20120926~52^2~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fd399ceed33ebc1ebcd5bd05285126ab14152633;p=karo-tx-linux.git 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 --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3ef96ca9a061..7bf2fef5cb88 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6230,7 +6230,7 @@ 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)