diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-03-12 21:25:22 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-04-19 17:25:21 +0200 |
commit | 45b87c5d2557a327bb702d00040cfbf2271b56ed (patch) | |
tree | c90e15d53d67b9f0969763c6bac856ee0626e783 /fs/btrfs/relocation.c | |
parent | btrfs: convert logic BUG_ON()'s in replace_path to ASSERT()'s (diff) | |
download | linux-45b87c5d2557a327bb702d00040cfbf2271b56ed.tar.xz linux-45b87c5d2557a327bb702d00040cfbf2271b56ed.zip |
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>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 62b6d3f1fbea..f1702157532a 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1231,7 +1231,11 @@ again: if (cow) { ret = btrfs_cow_block(trans, dest, eb, NULL, 0, &eb, BTRFS_NESTING_COW); - BUG_ON(ret); + if (ret) { + btrfs_tree_unlock(eb); + free_extent_buffer(eb); + return ret; + } } if (next_key) { @@ -1291,7 +1295,11 @@ again: ret = btrfs_cow_block(trans, dest, eb, parent, slot, &eb, BTRFS_NESTING_COW); - BUG_ON(ret); + if (ret) { + btrfs_tree_unlock(eb); + free_extent_buffer(eb); + break; + } } btrfs_tree_unlock(parent); |