aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2017-03-29 13:55:16 -0400
committerDavid Sterba <dsterba@suse.com>2017-04-18 08:07:26 -0400
commit1bcd7aa17fc1fa29009feec3e0ac4230d0d9f700 (patch)
tree0c0ffcaf4449e85de8714d177d7615dfc4e91045
parent171938e528079deced3226a17dcab12121312a64 (diff)
Btrfs: set scrub page's io_error if failing to submit io
Scrub repairs data by the unit called scrub_block, which may contain several pages. Scrub always tries to look up a good copy of a whole block, but if there's no such copy, it tries to do repair page by page. If we don't set page's io_error when checking this bad copy, in the last step, we may skip this page when repairing bad copy from good copy. Cc: David Sterba <dsterba@suse.cz> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/scrub.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 6ba0c9ddf777..f499ed782671 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1497,14 +1497,18 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
1497 1497
1498 bio_add_page(bio, page->page, PAGE_SIZE, 0); 1498 bio_add_page(bio, page->page, PAGE_SIZE, 0);
1499 if (!retry_failed_mirror && scrub_is_page_on_raid56(page)) { 1499 if (!retry_failed_mirror && scrub_is_page_on_raid56(page)) {
1500 if (scrub_submit_raid56_bio_wait(fs_info, bio, page)) 1500 if (scrub_submit_raid56_bio_wait(fs_info, bio, page)) {
1501 page->io_error = 1;
1501 sblock->no_io_error_seen = 0; 1502 sblock->no_io_error_seen = 0;
1503 }
1502 } else { 1504 } else {
1503 bio->bi_iter.bi_sector = page->physical >> 9; 1505 bio->bi_iter.bi_sector = page->physical >> 9;
1504 bio_set_op_attrs(bio, REQ_OP_READ, 0); 1506 bio_set_op_attrs(bio, REQ_OP_READ, 0);
1505 1507
1506 if (btrfsic_submit_bio_wait(bio)) 1508 if (btrfsic_submit_bio_wait(bio)) {
1509 page->io_error = 1;
1507 sblock->no_io_error_seen = 0; 1510 sblock->no_io_error_seen = 0;
1511 }
1508 } 1512 }
1509 1513
1510 bio_put(bio); 1514 bio_put(bio);