]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Btrfs: set scrub page's io_error if failing to submit io
authorLiu Bo <bo.li.liu@oracle.com>
Wed, 29 Mar 2017 17:55:16 +0000 (10:55 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Apr 2017 12:07:26 +0000 (14:07 +0200)
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>
fs/btrfs/scrub.c

index 6ba0c9ddf777d7f9863da2245e800c5caf08dd71..f499ed782671bf24ea3d9d4651b51ecaa14703dd 100644 (file)
@@ -1497,14 +1497,18 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
 
                bio_add_page(bio, page->page, PAGE_SIZE, 0);
                if (!retry_failed_mirror && scrub_is_page_on_raid56(page)) {
-                       if (scrub_submit_raid56_bio_wait(fs_info, bio, page))
+                       if (scrub_submit_raid56_bio_wait(fs_info, bio, page)) {
+                               page->io_error = 1;
                                sblock->no_io_error_seen = 0;
+                       }
                } else {
                        bio->bi_iter.bi_sector = page->physical >> 9;
                        bio_set_op_attrs(bio, REQ_OP_READ, 0);
 
-                       if (btrfsic_submit_bio_wait(bio))
+                       if (btrfsic_submit_bio_wait(bio)) {
+                               page->io_error = 1;
                                sblock->no_io_error_seen = 0;
+                       }
                }
 
                bio_put(bio);