Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Neil Brown <neilb@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

NeilBrown and committed by
Linus Torvalds
af03b8e4 edad01e2

+6
+6
drivers/md/raid10.c
··· 1867 1867 int d = r10_bio->devs[i].devnum; 1868 1868 bio = r10_bio->devs[i].bio; 1869 1869 bio->bi_end_io = NULL; 1870 + clear_bit(BIO_UPTODATE, &bio->bi_flags); 1870 1871 if (conf->mirrors[d].rdev == NULL || 1871 1872 test_bit(Faulty, &conf->mirrors[d].rdev->flags)) 1872 1873 continue; ··· 2038 2037 /* 'size' is now the number of chunks in the array */ 2039 2038 /* calculate "used chunks per device" in 'stride' */ 2040 2039 stride = size * conf->copies; 2040 + 2041 + /* We need to round up when dividing by raid_disks to 2042 + * get the stride size. 2043 + */ 2044 + stride += conf->raid_disks - 1; 2041 2045 sector_div(stride, conf->raid_disks); 2042 2046 mddev->size = stride << (conf->chunk_shift-1); 2043 2047