From 448999d84ddc2eaf36938176fb5091d2c2029e2f Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 28 Aug 2017 16:48:16 +0200 Subject: btrfs-progs: add crude error handling when transaction start fails Currently transaction bugs out insided btrfs_start_transaction in case of error, we want to lift the error handling to the callers. This patch adds the BUG_ON anywhere it's been missing so far. This is not the best way of course. Transforming BUG_ON to a proper error handling highly depends on the caller and should be dealt with case by case. Signed-off-by: David Sterba --- btrfstune.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'btrfstune.c') diff --git a/btrfstune.c b/btrfstune.c index 0139e408..eccedf79 100644 --- a/btrfstune.c +++ b/btrfstune.c @@ -66,6 +66,7 @@ static int update_seeding_flag(struct btrfs_root *root, int set_flag) } trans = btrfs_start_transaction(root, 1); + BUG_ON(IS_ERR(trans)); btrfs_set_super_flags(disk_super, super_flags); ret = btrfs_commit_transaction(trans, root); @@ -83,6 +84,7 @@ static int set_super_incompat_flags(struct btrfs_root *root, u64 flags) super_flags = btrfs_super_incompat_flags(disk_super); super_flags |= flags; trans = btrfs_start_transaction(root, 1); + BUG_ON(IS_ERR(trans)); btrfs_set_super_incompat_flags(disk_super, super_flags); ret = btrfs_commit_transaction(trans, root); -- cgit v1.2.3