diff options
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 31ade5802ae8..199a80134312 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -1724,6 +1724,7 @@ again: | |||
1724 | 1724 | ||
1725 | eb = read_tree_block(dest, old_bytenr, blocksize, | 1725 | eb = read_tree_block(dest, old_bytenr, blocksize, |
1726 | old_ptr_gen); | 1726 | old_ptr_gen); |
1727 | BUG_ON(!eb); | ||
1727 | btrfs_tree_lock(eb); | 1728 | btrfs_tree_lock(eb); |
1728 | if (cow) { | 1729 | if (cow) { |
1729 | ret = btrfs_cow_block(trans, dest, eb, parent, | 1730 | ret = btrfs_cow_block(trans, dest, eb, parent, |
@@ -2345,7 +2346,7 @@ struct btrfs_root *select_one_root(struct btrfs_trans_handle *trans, | |||
2345 | root = next->root; | 2346 | root = next->root; |
2346 | BUG_ON(!root); | 2347 | BUG_ON(!root); |
2347 | 2348 | ||
2348 | /* no other choice for non-refernce counted tree */ | 2349 | /* no other choice for non-references counted tree */ |
2349 | if (!root->ref_cows) | 2350 | if (!root->ref_cows) |
2350 | return root; | 2351 | return root; |
2351 | 2352 | ||
@@ -2513,6 +2514,10 @@ static int do_relocation(struct btrfs_trans_handle *trans, | |||
2513 | blocksize = btrfs_level_size(root, node->level); | 2514 | blocksize = btrfs_level_size(root, node->level); |
2514 | generation = btrfs_node_ptr_generation(upper->eb, slot); | 2515 | generation = btrfs_node_ptr_generation(upper->eb, slot); |
2515 | eb = read_tree_block(root, bytenr, blocksize, generation); | 2516 | eb = read_tree_block(root, bytenr, blocksize, generation); |
2517 | if (!eb) { | ||
2518 | err = -EIO; | ||
2519 | goto next; | ||
2520 | } | ||
2516 | btrfs_tree_lock(eb); | 2521 | btrfs_tree_lock(eb); |
2517 | btrfs_set_lock_blocking(eb); | 2522 | btrfs_set_lock_blocking(eb); |
2518 | 2523 | ||
@@ -2670,6 +2675,7 @@ static int get_tree_block_key(struct reloc_control *rc, | |||
2670 | BUG_ON(block->key_ready); | 2675 | BUG_ON(block->key_ready); |
2671 | eb = read_tree_block(rc->extent_root, block->bytenr, | 2676 | eb = read_tree_block(rc->extent_root, block->bytenr, |
2672 | block->key.objectid, block->key.offset); | 2677 | block->key.objectid, block->key.offset); |
2678 | BUG_ON(!eb); | ||
2673 | WARN_ON(btrfs_header_level(eb) != block->level); | 2679 | WARN_ON(btrfs_header_level(eb) != block->level); |
2674 | if (block->level == 0) | 2680 | if (block->level == 0) |
2675 | btrfs_item_key_to_cpu(eb, &block->key, 0); | 2681 | btrfs_item_key_to_cpu(eb, &block->key, 0); |
@@ -4209,7 +4215,7 @@ out: | |||
4209 | if (IS_ERR(fs_root)) | 4215 | if (IS_ERR(fs_root)) |
4210 | err = PTR_ERR(fs_root); | 4216 | err = PTR_ERR(fs_root); |
4211 | else | 4217 | else |
4212 | btrfs_orphan_cleanup(fs_root); | 4218 | err = btrfs_orphan_cleanup(fs_root); |
4213 | } | 4219 | } |
4214 | return err; | 4220 | return err; |
4215 | } | 4221 | } |