]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Btrfs: report errors when checksum is not found
authorLiu Bo <bo.li.liu@oracle.com>
Tue, 11 Jul 2017 20:43:16 +0000 (14:43 -0600)
committerDavid Sterba <dsterba@suse.com>
Wed, 16 Aug 2017 14:12:02 +0000 (16:12 +0200)
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 <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index 95c212037095fea727f4a35ea19d9d7e54ad8cfe..97970602c3d55908e47c6b031c1bdcbd527659d9 100644 (file)
@@ -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;
 }