diff options
author | Mark Fasheh <mfasheh@suse.com> | 2011-07-13 13:38:47 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2011-07-14 17:14:44 -0400 |
commit | d8926bb3badd36670fecf2de4a062c78bc37430b (patch) | |
tree | 60c8194f9fbba47ff9535b62b9fe439239997e9c /fs/btrfs/file-item.c | |
parent | 8d86e5f91440aa56a5df516bf58fe3883552ad56 (diff) |
btrfs: don't BUG_ON btrfs_alloc_path() errors
This patch fixes many callers of btrfs_alloc_path() which BUG_ON allocation
failure. All the sites that are fixed in this patch were checked by me to
be fairly trivial to fix because of at least one of two criteria:
- Callers of the function catch errors from it already so bubbling the
error up will be handled.
- Callers of the function might BUG_ON any nonzero return code in which
case there is no behavior changed (but we still got to remove a BUG_ON)
The following functions were updated:
btrfs_lookup_extent, alloc_reserved_tree_block, btrfs_remove_block_group,
btrfs_lookup_csums_range, btrfs_csum_file_blocks, btrfs_mark_extent_written,
btrfs_inode_by_name, btrfs_new_inode, btrfs_symlink,
insert_reserved_file_extent, and run_delalloc_nocow
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/btrfs/file-item.c')
-rw-r--r-- | fs/btrfs/file-item.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 90d4ee52cd45..f92ff0ed6e03 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -282,7 +282,8 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, | |||
282 | u16 csum_size = btrfs_super_csum_size(&root->fs_info->super_copy); | 282 | u16 csum_size = btrfs_super_csum_size(&root->fs_info->super_copy); |
283 | 283 | ||
284 | path = btrfs_alloc_path(); | 284 | path = btrfs_alloc_path(); |
285 | BUG_ON(!path); | 285 | if (!path) |
286 | return -ENOMEM; | ||
286 | 287 | ||
287 | if (search_commit) { | 288 | if (search_commit) { |
288 | path->skip_locking = 1; | 289 | path->skip_locking = 1; |
@@ -672,7 +673,9 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, | |||
672 | btrfs_super_csum_size(&root->fs_info->super_copy); | 673 | btrfs_super_csum_size(&root->fs_info->super_copy); |
673 | 674 | ||
674 | path = btrfs_alloc_path(); | 675 | path = btrfs_alloc_path(); |
675 | BUG_ON(!path); | 676 | if (!path) |
677 | return -ENOMEM; | ||
678 | |||
676 | sector_sum = sums->sums; | 679 | sector_sum = sums->sums; |
677 | again: | 680 | again: |
678 | next_offset = (u64)-1; | 681 | next_offset = (u64)-1; |