aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2017-05-15 17:20:07 -0700
committerLiu Bo <bo.li.liu@oracle.com>2017-05-16 22:07:40 -0700
commit812cb9799ae999f07b058ce671b6da2b8b8f6e27 (patch)
tree186c1db950a2b8e7111cd8ef7fadb11a17a3b01f /fs
parent991eabced900e5fb44cc22a88b6d1299f9a9b7e8 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fbc36bc174d2..830baf4b2256 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7941,6 +7941,7 @@ static int __btrfs_correct_data_nocsum(struct inode *inode,
u32 sectorsize;
int nr_sectors;
int ret;
+ int err = 0;
fs_info = BTRFS_I(inode)->root->fs_info;
sectorsize = fs_info->sectorsize;
@@ -7962,8 +7963,10 @@ next_block_or_try_again:
pgoff, start, start + sectorsize - 1,
io_bio->mirror_num,
btrfs_retry_endio_nocsum, &done);
- if (ret)
- return ret;
+ if (ret) {
+ err = ret;
+ goto next;
+ }
wait_for_completion(&done.done);
@@ -7972,6 +7975,7 @@ next_block_or_try_again:
goto next_block_or_try_again;
}
+next:
start += sectorsize;
nr_sectors--;
@@ -7982,7 +7986,7 @@ next_block_or_try_again:
}
}
- return 0;
+ return err;
}
static void btrfs_retry_endio(struct bio *bio)