Skip to content

Commit

Permalink
md/raid10: Don't try to recovery unmatched (and unused) chunks.
Browse files Browse the repository at this point in the history
If a RAID10 has an odd number of chunks - as might happen when there
are an odd number of devices - the last chunk has no pair and so is
not mirrored.  We don't store data there, but when recovering the last
device in an array we retry to recover that last chunk from a
non-existent location.  This results in an error, and the recovery
aborts.

When we get to that last chunk we should just stop - there is nothing
more to do anyway.

This bug has been present since the introduction of RAID10, so the
patch is appropriate for any -stable kernel.

Cc: stable@vger.kernel.org
Reported-by: Christian Balzer <chibi@gol.com>
Tested-by: Christian Balzer <chibi@gol.com>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Jul 3, 2012
1 parent 6b16351 commit fc448a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -2890,6 +2890,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
/* want to reconstruct this device */
rb2 = r10_bio;
sect = raid10_find_virt(conf, sector_nr, i);
if (sect >= mddev->resync_max_sectors) {
/* last stripe is not complete - don't
* try to recover this sector.
*/
continue;
}
/* Unless we are doing a full sync, or a replacement
* we only need to recover the block if it is set in
* the bitmap
Expand Down

0 comments on commit fc448a1

Please sign in to comment.