]> asedeno.scripts.mit.edu Git - linux.git/commit
Btrfs: clean up error handling in btrfs_truncate()
authorOmar Sandoval <osandov@fb.com>
Tue, 22 May 2018 16:59:50 +0000 (09:59 -0700)
committerDavid Sterba <dsterba@suse.com>
Wed, 30 May 2018 19:27:32 +0000 (21:27 +0200)
commitad7e1a740d940cf7da1beb332a1095bcda40c747
tree61e67aefe0abc6f1d4a06e2d34b6dcad94edff71
parentc5794e51784a0a96dd82e8f955570a7eccf27e5d
Btrfs: clean up error handling in btrfs_truncate()

btrfs_truncate() uses two variables for error handling, ret and err (if
this sounds familiar, it's because btrfs_truncate_inode_items() did
something similar). This is error prone, as was made evident by "Btrfs:
fix error handling in btrfs_truncate()". We only have err because we
don't want to mask an error if we call btrfs_update_inode() and
btrfs_end_transaction(), so let's make that its own scoped return
variable and use ret everywhere else.

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