aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
authorWang Shilong <wangsl-fnst@cn.fujitsu.com>2013-04-15 06:26:38 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-05-06 15:54:50 -0400
commite36902d4cc95382771f501f8d1d8c0a9b356500d (patch)
tree3fafd80f62d349a970b83490999c8fe6bad9480d /fs/btrfs/backref.c
parent9c931c5ab2e97f4408e314518ad22845eca6ed89 (diff)
Btrfs: do not continue if out of memory happens
If out of memory happens, we should return -ENOMEM directly to the caller rather than continue the work. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> 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 7f448b8325a1..8623c74dfa08 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -352,6 +352,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
352 err = __resolve_indirect_ref(fs_info, search_commit_root, 352 err = __resolve_indirect_ref(fs_info, search_commit_root,
353 time_seq, ref, parents, 353 time_seq, ref, parents,
354 extent_item_pos); 354 extent_item_pos);
355 if (err == -ENOMEM)
356 goto out;
355 if (err) 357 if (err)
356 continue; 358 continue;
357 359
@@ -367,7 +369,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
367 new_ref = kmalloc(sizeof(*new_ref), GFP_NOFS); 369 new_ref = kmalloc(sizeof(*new_ref), GFP_NOFS);
368 if (!new_ref) { 370 if (!new_ref) {
369 ret = -ENOMEM; 371 ret = -ENOMEM;
370 break; 372 goto out;
371 } 373 }
372 memcpy(new_ref, ref, sizeof(*ref)); 374 memcpy(new_ref, ref, sizeof(*ref));
373 new_ref->parent = node->val; 375 new_ref->parent = node->val;
@@ -377,7 +379,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
377 } 379 }
378 ulist_reinit(parents); 380 ulist_reinit(parents);
379 } 381 }
380 382out:
381 ulist_free(parents); 383 ulist_free(parents);
382 return ret; 384 return ret;
383} 385}