From: Liu Bo Date: Tue, 11 Jul 2017 20:43:16 +0000 (-0600) Subject: Btrfs: report errors when checksum is not found X-Git-Tag: v4.14-rc1~80^2~82 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=0d1e0bead62a1778c45f22439cf067e63068faea;p=linux.git Btrfs: report errors when checksum is not found When btrfs fails the checksum check, it'll fill the whole page with "1". However, if %csum_expected is 0 (which means there is no checksum), then for some unknown reason, we just pretend that the read is correct, so userspace would be confused about the dilemma that read is successful but getting a page with all content being "1". This can happen due to a bug in btrfs-convert. This fixes it by always returning errors if checksum doesn't match. Signed-off-by: Liu Bo Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 95c212037095..97970602c3d5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3159,8 +3159,6 @@ static int __readpage_endio_check(struct inode *inode, memset(kaddr + pgoff, 1, len); flush_dcache_page(page); kunmap_atomic(kaddr); - if (csum_expected == 0) - return 0; return -EIO; }