Commit 9711bd8c authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

md: Fix two raid10 bugs.

1/ When resyncing a degraded raid10 which has more than 2 copies of each block,
  garbage can get synced on top of good data.

2/ We round the wrong way in part of the device size calculation, which
  can cause confusion.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b34eb784
...@@ -1867,6 +1867,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i ...@@ -1867,6 +1867,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
int d = r10_bio->devs[i].devnum; int d = r10_bio->devs[i].devnum;
bio = r10_bio->devs[i].bio; bio = r10_bio->devs[i].bio;
bio->bi_end_io = NULL; bio->bi_end_io = NULL;
clear_bit(BIO_UPTODATE, &bio->bi_flags);
if (conf->mirrors[d].rdev == NULL || if (conf->mirrors[d].rdev == NULL ||
test_bit(Faulty, &conf->mirrors[d].rdev->flags)) test_bit(Faulty, &conf->mirrors[d].rdev->flags))
continue; continue;
...@@ -2037,6 +2038,11 @@ static int run(mddev_t *mddev) ...@@ -2037,6 +2038,11 @@ static int run(mddev_t *mddev)
/* 'size' is now the number of chunks in the array */ /* 'size' is now the number of chunks in the array */
/* calculate "used chunks per device" in 'stride' */ /* calculate "used chunks per device" in 'stride' */
stride = size * conf->copies; stride = size * conf->copies;
/* We need to round up when dividing by raid_disks to
* get the stride size.
*/
stride += conf->raid_disks - 1;
sector_div(stride, conf->raid_disks); sector_div(stride, conf->raid_disks);
mddev->size = stride << (conf->chunk_shift-1); mddev->size = stride << (conf->chunk_shift-1);
......
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