Commit 8dbed5cebdf6796bf2618457b3653cf820934366

Authored by NeilBrown
1 parent 7399c31bc9

md/raid10 - avoid reading from known bad blocks - part 3

When attempting to repair a read error, don't read from
devices with a known bad block.

As we are only reading PAGE_SIZE blocks, we don't try to
narrow down to smaller regions in the hope that only part of this
page is bad - it isn't worth the effort.

Signed-off-by: NeilBrown <neilb@suse.de>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -1594,10 +1594,15 @@
1594 1594  
1595 1595 rcu_read_lock();
1596 1596 do {
  1597 + sector_t first_bad;
  1598 + int bad_sectors;
  1599 +
1597 1600 d = r10_bio->devs[sl].devnum;
1598 1601 rdev = rcu_dereference(conf->mirrors[d].rdev);
1599 1602 if (rdev &&
1600   - test_bit(In_sync, &rdev->flags)) {
  1603 + test_bit(In_sync, &rdev->flags) &&
  1604 + is_badblock(rdev, r10_bio->devs[sl].addr + sect, s,
  1605 + &first_bad, &bad_sectors) == 0) {
1601 1606 atomic_inc(&rdev->nr_pending);
1602 1607 rcu_read_unlock();
1603 1608 success = sync_page_io(rdev,