aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
authorWang Shilong <wangsl-fnst@cn.fujitsu.com>2013-03-29 19:03:21 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:54:30 -0400
commitf172393952a8771ca8970b8fcdd332a5a6ea0f56 (patch)
treec7efbf55501297e39f967660657dd7f29f753eac /fs/btrfs/backref.c
parent41b0fc42800569f63e029549b75c4c9cb63f2dfd (diff)
Btrfs: kill some BUG_ONs() in the find_parent_nodes()
The reason that BUG_ON() happens in these places is just because of ENOMEM. We try ro return ENOMEM rather than trigger BUG_ON(), the caller will abort the transaction thus avoiding the kernel panic. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com> Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r--fs/btrfs/backref.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index bd605c87adfd..3dd0693bad78 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -900,7 +900,8 @@ again:
900 if (ref->count && ref->root_id && ref->parent == 0) { 900 if (ref->count && ref->root_id && ref->parent == 0) {
901 /* no parent == root of tree */ 901 /* no parent == root of tree */
902 ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS); 902 ret = ulist_add(roots, ref->root_id, 0, GFP_NOFS);
903 BUG_ON(ret < 0); 903 if (ret < 0)
904 goto out;
904 } 905 }
905 if (ref->count && ref->parent) { 906 if (ref->count && ref->parent) {
906 struct extent_inode_elem *eie = NULL; 907 struct extent_inode_elem *eie = NULL;
@@ -920,6 +921,8 @@ again:
920 ret = ulist_add_merge(refs, ref->parent, 921 ret = ulist_add_merge(refs, ref->parent,
921 (uintptr_t)ref->inode_list, 922 (uintptr_t)ref->inode_list,
922 (u64 *)&eie, GFP_NOFS); 923 (u64 *)&eie, GFP_NOFS);
924 if (ret < 0)
925 goto out;
923 if (!ret && extent_item_pos) { 926 if (!ret && extent_item_pos) {
924 /* 927 /*
925 * we've recorded that parent, so we must extend 928 * we've recorded that parent, so we must extend
@@ -930,7 +933,6 @@ again:
930 eie = eie->next; 933 eie = eie->next;
931 eie->next = ref->inode_list; 934 eie->next = ref->inode_list;
932 } 935 }
933 BUG_ON(ret < 0);
934 } 936 }
935 kfree(ref); 937 kfree(ref);
936 } 938 }