Skip to content

Commit

Permalink
Btrfs: avoid I/O repair BUG() from btree_read_extent_buffer_pages()
Browse files Browse the repository at this point in the history
From btree_read_extent_buffer_pages(), currently repair_io_failure()
can be called with mirror_num being zero when submit_one_bio() returned
an error before. This used to cause a BUG_ON(!mirror_num) in
repair_io_failure() and indeed this is not a case that needs the I/O
repair code to rewrite disk blocks.
This commit prevents calling repair_io_failure() in this case and thus
avoids the BUG_ON() and malfunction.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Stefan Behrens authored and Chris Mason committed Jul 23, 2012
1 parent f4c738c commit c090158
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root,
break;
}

if (failed && !ret)
if (failed && !ret && failed_mirror)
repair_eb_io_failure(root, eb, failed_mirror);

return ret;
Expand Down

0 comments on commit c090158

Please sign in to comment.