Skip to content

Commit

Permalink
Btrfs: fix oops while writing data to SSD partitions
Browse files Browse the repository at this point in the history
Here I have a two SSD-partitions btrfs, and they are defaultly set to
"data=raid0, metadata=raid1", then I try to fill my btrfs partition
till "No space left on device", via "dd if=/dev/zero of=/mnt/btrfs/tmp".

I get an oops panic from kernel BUG at fs/btrfs/extent-tree.c:5199!, which
refers to find_free_extent's
BUG_ON(index != get_block_group_index(block_group));

In SSD mode, in order to find enough space to alloc, we may check the
block_group cache which has been checked sometime before, but the index is not
updated, where it hits the BUG_ON.

Signed-off-by: Liu Bo <[email protected]>
Acked-by: Josef Bacik <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
liub authored and chrismason-xx committed Aug 1, 2011
1 parent 61cfea9 commit ff1f2b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5079,7 +5079,9 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
* group is does point to and try again
*/
if (!last_ptr_loop && last_ptr->block_group &&
last_ptr->block_group != block_group) {
last_ptr->block_group != block_group &&
index <=
get_block_group_index(last_ptr->block_group)) {

btrfs_put_block_group(block_group);
block_group = last_ptr->block_group;
Expand Down

0 comments on commit ff1f2b4

Please sign in to comment.