Skip to content

Commit

Permalink
Btrfs: add missing error checks to add_data_references
Browse files Browse the repository at this point in the history
The function relocation.c:add_data_references() was not checking
if all calls to __add_tree_block() and find_data_references() were
succeeding or not.

Signed-off-by: Filipe David Borba Manana <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
fdmanana authored and Chris Mason committed Sep 1, 2013
1 parent ccf39f9 commit 647f63b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -3628,7 +3628,7 @@ int add_data_references(struct reloc_control *rc,
unsigned long ptr;
unsigned long end;
u32 blocksize = btrfs_level_size(rc->extent_root, 0);
int ret;
int ret = 0;
int err = 0;

eb = path->nodes[0];
Expand All @@ -3655,6 +3655,10 @@ int add_data_references(struct reloc_control *rc,
} else {
BUG();
}
if (ret) {
err = ret;
goto out;
}
ptr += btrfs_extent_inline_ref_size(key.type);
}
WARN_ON(ptr > end);
Expand Down Expand Up @@ -3700,6 +3704,7 @@ int add_data_references(struct reloc_control *rc,
}
path->slots[0]++;
}
out:
btrfs_release_path(path);
if (err)
free_block_list(blocks);
Expand Down

0 comments on commit 647f63b

Please sign in to comment.