aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-05-11 00:50:37 -0400
committerNeilBrown <neilb@suse.de>2011-05-11 00:50:37 -0400
commit7ca78d57d11a91bc93b35342fa58647b85bedeb1 (patch)
tree398f2f91e5252b45872506763ae3677e1f35c026 /drivers/md
parent78d7f5f726deb562a51126603f2dc5d00990b223 (diff)
md/raid1: try fix_sync_read_error before process_checks.
If we get a read error during resync/recovery we current repeat with single-page reads to find out just where the error is, and possibly read each page from a different device. With check/repair we don't currently do that, we just fail. However it is possible that while all devices fail on the large 64K read, we might be able to satisfy each 4K from one device or another. So call fix_sync_read_error before process_checks to maximise the chance of finding good data and writing it out to the devices with read errors. For this to work, we need to set the 'uptodate' flags properly after fix_sync_read_error has succeeded. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid1.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 2b9e86ceaf2f..b9d6da1272f1 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1282,6 +1282,7 @@ static int fix_sync_read_error(r1bio_t *r1_bio)
1282 idx ++; 1282 idx ++;
1283 } 1283 }
1284 set_bit(R1BIO_Uptodate, &r1_bio->state); 1284 set_bit(R1BIO_Uptodate, &r1_bio->state);
1285 set_bit(BIO_UPTODATE, &bio->bi_flags);
1285 return 1; 1286 return 1;
1286} 1287}
1287 1288
@@ -1299,15 +1300,6 @@ static int process_checks(r1bio_t *r1_bio)
1299 int primary; 1300 int primary;
1300 int i; 1301 int i;
1301 1302
1302 if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) {
1303 for (i=0; i < conf->raid_disks; i++)
1304 if (r1_bio->bios[i]->bi_end_io == end_sync_read)
1305 md_error(mddev, conf->mirrors[i].rdev);
1306
1307 md_done_sync(mddev, r1_bio->sectors, 1);
1308 put_buf(r1_bio);
1309 return -1;
1310 }
1311 for (primary = 0; primary < conf->raid_disks; primary++) 1303 for (primary = 0; primary < conf->raid_disks; primary++)
1312 if (r1_bio->bios[primary]->bi_end_io == end_sync_read && 1304 if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
1313 test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) { 1305 test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) {
@@ -1385,15 +1377,14 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1385 1377
1386 bio = r1_bio->bios[r1_bio->read_disk]; 1378 bio = r1_bio->bios[r1_bio->read_disk];
1387 1379
1388
1389 if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
1390 if (process_checks(r1_bio) < 0)
1391 return;
1392
1393 if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) 1380 if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
1394 /* ouch - failed to read all of that. */ 1381 /* ouch - failed to read all of that. */
1395 if (!fix_sync_read_error(r1_bio)) 1382 if (!fix_sync_read_error(r1_bio))
1396 return; 1383 return;
1384
1385 if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
1386 if (process_checks(r1_bio) < 0)
1387 return;
1397 /* 1388 /*
1398 * schedule writes 1389 * schedule writes
1399 */ 1390 */