aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-08-30 15:09:51 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-21 10:58:54 -0400
commit83d4cfd4da57b6ff16296875a962de2158799de6 (patch)
tree4137d0e5d3a72243303a3cee5107f3db57963b7f /fs/btrfs/ctree.c
parent07f0e62e7f2533918f28e780ab3cfeea1a63145d (diff)
Btrfs: fixup error handling in btrfs_reloc_cow
If we failed to actually allocate the correct size of the extent to relocate we will end up in an infinite loop because we won't return an error, we'll just move on to the next extent. So fix this up by returning an error, and then fix all the callers to return an error up the stack rather than BUG_ON()'ing. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 64346721173f..61b5bcd57b7e 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1005,8 +1005,11 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
1005 return ret; 1005 return ret;
1006 } 1006 }
1007 1007
1008 if (root->ref_cows) 1008 if (root->ref_cows) {
1009 btrfs_reloc_cow_block(trans, root, buf, cow); 1009 ret = btrfs_reloc_cow_block(trans, root, buf, cow);
1010 if (ret)
1011 return ret;
1012 }
1010 1013
1011 if (buf == root->node) { 1014 if (buf == root->node) {
1012 WARN_ON(parent && parent != buf); 1015 WARN_ON(parent && parent != buf);