Skip to content

Commit

Permalink
Btrfs: abort transaction if we don't find the block group
Browse files Browse the repository at this point in the history
We shouldn't BUG_ON() if there is corruption.  I hit this while testing my block
group patch and the abort worked properly.  Thanks,

Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
Josef Bacik authored and masoncl committed Jan 2, 2015
1 parent 6b6d24b commit df95e7f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3139,21 +3139,21 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans,
struct extent_buffer *leaf;

ret = btrfs_search_slot(trans, extent_root, &cache->key, path, 0, 1);
if (ret < 0)
if (ret) {
if (ret > 0)
ret = -ENOENT;
goto fail;
BUG_ON(ret); /* Corruption */
}

leaf = path->nodes[0];
bi = btrfs_item_ptr_offset(leaf, path->slots[0]);
write_extent_buffer(leaf, &cache->item, bi, sizeof(cache->item));
btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(path);
fail:
if (ret) {
if (ret)
btrfs_abort_transaction(trans, root, ret);
return ret;
}
return 0;
return ret;

}

Expand Down

0 comments on commit df95e7f

Please sign in to comment.