summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-28 16:48:16 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit448999d84ddc2eaf36938176fb5091d2c2029e2f (patch)
tree4e90505605420f6d3467639d2899e93c893596dd /disk-io.c
parent4ef5a112c9d2fe9d6f03ac2ea3aa5b1af0f37254 (diff)
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 <dsterba@suse.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/disk-io.c b/disk-io.c
index 30e656c2..f969c9b5 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -1753,8 +1753,10 @@ int close_ctree_fs_info(struct btrfs_fs_info *fs_info)
fs_info->generation) {
BUG_ON(!root);
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
btrfs_commit_transaction(trans, root);
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
ret = commit_tree_roots(trans, fs_info);
BUG_ON(ret);
ret = __commit_transaction(trans, root);