With raid1 profile, dio read isn't tolerating IO errors if read length is
less than the stripe length (64K).

This fixes the problem by setting bio's error to 0 if a good copy has been
found.

Signed-off-by: Liu Bo <bo.li....@oracle.com>
---
 fs/btrfs/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 632b616..4e1398e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8113,8 +8113,11 @@ static void btrfs_endio_direct_read(struct bio *bio)
        struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
        int err = bio->bi_error;
 
-       if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED)
+       if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) {
                err = btrfs_subio_endio_read(inode, io_bio, err);
+               if (!err)
+                       bio->bi_error = 0;
+       }
 
        unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset,
                      dip->logical_offset + dip->bytes - 1);
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to