Btrfs: fix error handling in btrfs_truncate_inode_items()
authorOmar Sandoval <osandov@fb.com>
Fri, 11 May 2018 20:13:30 +0000 (13:13 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:23:44 +0000 (18:23 +0200)
commitfd86a3a31506fe4602ad056bc06a16f20e8eb30f
tree6d0122d556e1ff8fbd6fbac84523403f9d634cd6
parentd1342aadbd9fcc82fd6e24c7f0443a43fe4714c7
Btrfs: fix error handling in btrfs_truncate_inode_items()

btrfs_truncate_inode_items() uses two variables for error handling, ret
and err. These are not handled consistently, leading to a couple of
bugs.

- Errors from btrfs_del_items() are handled but not propagated to the
  caller
- If btrfs_run_delayed_refs() fails and aborts the transaction, we
  continue running

Just use ret everywhere and simplify things a bit, fixing both of these
issues.

Fixes: 79787eaab461 ("btrfs: replace many BUG_ONs with proper error handling")
Fixes: 1262133b8d6f ("Btrfs: account for crcs in delayed ref processing")
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c