Btrfs: record error if one block has failed to retry

In the nocsum case of dio read endio, it returns immediately if an error
gets returned when repairing, which leaves the rest blocks unrepaired.  The
behavior is different from how buffered read endio works in the same case.
This changes it to record error only and go on repairing the rest blocks.

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>
This commit is contained in:
Liu Bo 2017-05-15 17:20:07 -07:00 committed by David Sterba
parent 17347cec15
commit 629ebf4fad
1 changed files with 7 additions and 3 deletions

View File

@ -8078,6 +8078,7 @@ static int __btrfs_correct_data_nocsum(struct inode *inode,
u32 sectorsize; u32 sectorsize;
int nr_sectors; int nr_sectors;
int ret; int ret;
int err = 0;
fs_info = BTRFS_I(inode)->root->fs_info; fs_info = BTRFS_I(inode)->root->fs_info;
sectorsize = fs_info->sectorsize; sectorsize = fs_info->sectorsize;
@ -8099,8 +8100,10 @@ next_block_or_try_again:
pgoff, start, start + sectorsize - 1, pgoff, start, start + sectorsize - 1,
io_bio->mirror_num, io_bio->mirror_num,
btrfs_retry_endio_nocsum, &done); btrfs_retry_endio_nocsum, &done);
if (ret) if (ret) {
return ret; err = ret;
goto next;
}
wait_for_completion(&done.done); wait_for_completion(&done.done);
@ -8109,6 +8112,7 @@ next_block_or_try_again:
goto next_block_or_try_again; goto next_block_or_try_again;
} }
next:
start += sectorsize; start += sectorsize;
nr_sectors--; nr_sectors--;
@ -8119,7 +8123,7 @@ next_block_or_try_again:
} }
} }
return 0; return err;
} }
static void btrfs_retry_endio(struct bio *bio) static void btrfs_retry_endio(struct bio *bio)