Several function return values were being completely
ignored.

V2: Added more error checking all over extent-tree.c

Signed-off-by: Filipe David Borba Manana <fdman...@gmail.com>
---
 extent-tree.c |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/extent-tree.c b/extent-tree.c
index 6490d8a..6458ce4 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2110,6 +2110,7 @@ static int finish_current_insert(struct 
btrfs_trans_handle *trans,
                                                extent_op->flags,
                                                &extent_op->key,
                                                extent_op->level, &key);
+                       BUG_ON(ret);
                } else {
                        BUG_ON(1);
                }
@@ -2756,7 +2757,7 @@ static int alloc_reserved_tree_block(struct 
btrfs_trans_handle *trans,
 
        ret = update_block_group(trans, root, ins->objectid, root->leafsize,
                                 1, 0);
-       return 0;
+       return ret;
 }
 
 static int alloc_tree_block(struct btrfs_trans_handle *trans,
@@ -3345,12 +3346,14 @@ btrfs_add_block_group(struct btrfs_fs_info *fs_info, 
u64 bytes_used, u64 type,
        BUG_ON(ret);
 
        bit = block_group_state_bits(type);
-       set_extent_bits(block_group_cache, chunk_offset,
-                       chunk_offset + size - 1,
-                       bit | EXTENT_LOCKED, GFP_NOFS);
+       ret = set_extent_bits(block_group_cache, chunk_offset,
+                             chunk_offset + size - 1,
+                             bit | EXTENT_LOCKED, GFP_NOFS);
+       BUG_ON(ret);
 
-       set_state_private(block_group_cache, chunk_offset,
-                         (unsigned long)cache);
+       ret = set_state_private(block_group_cache, chunk_offset,
+                               (unsigned long)cache);
+       BUG_ON(ret);
        set_avail_alloc_bits(fs_info, type);
 
        return cache;
@@ -3372,8 +3375,11 @@ int btrfs_make_block_group(struct btrfs_trans_handle 
*trans,
                                sizeof(cache->item));
        BUG_ON(ret);
 
-       finish_current_insert(trans, extent_root);
+       ret = finish_current_insert(trans, extent_root);
+       BUG_ON(ret);
        ret = del_pending_extents(trans, extent_root);
+       BUG_ON(ret);
+
        return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to