btrfs: handle failure of add_pending_csums
authorNikolay Borisov <nborisov@suse.com>
Mon, 8 Jan 2018 08:59:43 +0000 (10:59 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 1 Mar 2018 15:16:00 +0000 (16:16 +0100)
commitac01f26a27f10aace4bb89fd2c2c05a60c251832
treeec27915237f6e7ad42d31193b175d9bff0d5a036
parenta8fd1f71749387c9a1053a83ff1c16287499a4e7
btrfs: handle failure of add_pending_csums

add_pending_csums was added as part of the new data=ordered
implementation in e6dcd2dc9c48 ("Btrfs: New data=ordered
implementation"). Even back then it called the btrfs_csum_file_blocks
which can fail but it never bothered handling the failure. In ENOMEM
situation this could lead to the filesystem failing to write the
checksums for a particular extent and not detect this. On read this
could lead to the filesystem erroring out due to crc mismatch. Fix it by
propagating failure from add_pending_csums and handling them.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c