Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: avoid transaction commit on error in insert_balance_item()

There's no point in committing the transaction if we failed to insert the
balance item, since we haven't done anything else after we started/joined
the transaction. Also stop using two variables for tracking the return
value and use only 'ret'.

Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Filipe Manana and committed by
David Sterba
8d206b0c 7d7608cc

+6 -4
+6 -4
fs/btrfs/volumes.c
··· 3644 3644 struct btrfs_path *path; 3645 3645 struct extent_buffer *leaf; 3646 3646 struct btrfs_key key; 3647 - int ret, err; 3647 + int ret; 3648 3648 3649 3649 path = btrfs_alloc_path(); 3650 3650 if (!path) ··· 3679 3679 btrfs_set_balance_flags(leaf, item, bctl->flags); 3680 3680 out: 3681 3681 btrfs_free_path(path); 3682 - err = btrfs_commit_transaction(trans); 3683 - if (err && !ret) 3684 - ret = err; 3682 + if (ret == 0) 3683 + ret = btrfs_commit_transaction(trans); 3684 + else 3685 + btrfs_end_transaction(trans); 3686 + 3685 3687 return ret; 3686 3688 } 3687 3689