Skip to content

Commit

Permalink
md/raid5: be careful not to resize_stripes too big.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
NeilBrown committed Oct 11, 2012
1 parent db07d85 commit e56108d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e56108d

Please sign in to comment.