Commit 6d3baf2e authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] md: fix for raid6 reshape

Recent patch for raid6 reshape had a change missing that showed up in
subsequent review.

Many places in the raid5 code used "conf->raid_disks-1" to mean "number of
data disks".  With raid6 that had to be changed to "conf->raid_disk -
conf->max_degraded" or similar.  One place was missed.

This bug means that if a raid6 reshape were aborted in the middle the
recorded position would be wrong.  On restart it would either fail (as the
position wasn't on an appropriate boundary) or would leave a section of the
array unreshaped, causing data corruption.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c6b36e9a
...@@ -3071,7 +3071,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped ...@@ -3071,7 +3071,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
release_stripe(sh); release_stripe(sh);
} }
spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock);
conf->expand_progress = (sector_nr + i)*(conf->raid_disks-1); conf->expand_progress = (sector_nr + i) * new_data_disks;
spin_unlock_irq(&conf->device_lock); spin_unlock_irq(&conf->device_lock);
/* Ok, those stripe are ready. We can start scheduling /* Ok, those stripe are ready. We can start scheduling
* reads on the source stripes. * reads on the source stripes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment