]> git.baikalelectronics.ru Git - kernel.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)
commit84b28890c73944013de4e4ee8fd7718e746653e4
tree61e67aefe0abc6f1d4a06e2d34b6dcad94edff71
parentf4a0e6938c23d5825811da4a84232ec95ddcb74c
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