btrfs: handle btrfs_cow_block errors in replace_path
If we error out COWing the root node when doing a replace_path then we simply unlock and free the buffer and return the error. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
7a9213a935
commit
45b87c5d25
@ -1231,7 +1231,11 @@ again:
|
|||||||
if (cow) {
|
if (cow) {
|
||||||
ret = btrfs_cow_block(trans, dest, eb, NULL, 0, &eb,
|
ret = btrfs_cow_block(trans, dest, eb, NULL, 0, &eb,
|
||||||
BTRFS_NESTING_COW);
|
BTRFS_NESTING_COW);
|
||||||
BUG_ON(ret);
|
if (ret) {
|
||||||
|
btrfs_tree_unlock(eb);
|
||||||
|
free_extent_buffer(eb);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_key) {
|
if (next_key) {
|
||||||
@ -1291,7 +1295,11 @@ again:
|
|||||||
ret = btrfs_cow_block(trans, dest, eb, parent,
|
ret = btrfs_cow_block(trans, dest, eb, parent,
|
||||||
slot, &eb,
|
slot, &eb,
|
||||||
BTRFS_NESTING_COW);
|
BTRFS_NESTING_COW);
|
||||||
BUG_ON(ret);
|
if (ret) {
|
||||||
|
btrfs_tree_unlock(eb);
|
||||||
|
free_extent_buffer(eb);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_tree_unlock(parent);
|
btrfs_tree_unlock(parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user