diff options
author | Wang Shilong <wangsl-fnst@cn.fujitsu.com> | 2013-04-15 10:26:38 +0000 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-05-06 15:54:50 -0400 |
commit | e36902d4cc95382771f501f8d1d8c0a9b356500d (patch) | |
tree | 3fafd80f62d349a970b83490999c8fe6bad9480d /fs/btrfs | |
parent | 9c931c5ab2e97f4408e314518ad22845eca6ed89 (diff) | |
download | lwn-e36902d4cc95382771f501f8d1d8c0a9b356500d.tar.gz lwn-e36902d4cc95382771f501f8d1d8c0a9b356500d.zip |
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')
-rw-r--r-- | fs/btrfs/backref.c | 6 |
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, err = __resolve_indirect_ref(fs_info, search_commit_root, time_seq, ref, parents, extent_item_pos); + if (err == -ENOMEM) + goto out; if (err) continue; @@ -367,7 +369,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info, new_ref = kmalloc(sizeof(*new_ref), GFP_NOFS); if (!new_ref) { ret = -ENOMEM; - break; + goto out; } memcpy(new_ref, ref, sizeof(*ref)); new_ref->parent = node->val; @@ -377,7 +379,7 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info, } ulist_reinit(parents); } - +out: ulist_free(parents); return ret; } |