aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorGravatar Filipe Manana <fdmanana@suse.com> 2022-02-03 15:36:43 +0000
committerGravatar David Sterba <dsterba@suse.com> 2022-03-14 13:13:50 +0100
commitbbf0ea7ea3855b35a2ab0b8d0000ce06cc58e4bf (patch)
treecffabc7196ceb02f3573c08abf0f581e8d6ed80d /fs/btrfs/inode.c
parentbtrfs: stop checking for NULL return from btrfs_get_extent() (diff)
downloadlinux-bbf0ea7ea3855b35a2ab0b8d0000ce06cc58e4bf.tar.gz
linux-bbf0ea7ea3855b35a2ab0b8d0000ce06cc58e4bf.tar.bz2
linux-bbf0ea7ea3855b35a2ab0b8d0000ce06cc58e4bf.zip
btrfs: fix lost error return value when reading a data page
At btrfs_do_readpage(), if we get an error when trying to lookup for an extent map, we end up marking the page with the error bit, clearing the uptodate bit on it, and doing everything else that should be done. However we return success (0) to the caller, when we should return the error encoded in the extent map pointer. So fix that by returning the error encoded in the pointer. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1ce1ccf6d22c..ffe327090277 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8118,8 +8118,13 @@ int btrfs_readpage(struct file *file, struct page *page)
btrfs_lock_and_flush_ordered_range(inode, start, end, NULL);
ret = btrfs_do_readpage(page, NULL, &bio_ctrl, 0, NULL);
- if (bio_ctrl.bio)
- ret = submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.bio_flags);
+ if (bio_ctrl.bio) {
+ int ret2;
+
+ ret2 = submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.bio_flags);
+ if (ret == 0)
+ ret = ret2;
+ }
return ret;
}