Skip to content

Commit

Permalink
Btrfs: return ENOMEM rather than use BUG_ON when btrfs_alloc_path fails
Browse files Browse the repository at this point in the history
Return ENOMEM rather trigger BUG_ON, fix it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
Reviewed-by: Zach Brown <zab@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Wang Shilong authored and Josef Bacik committed Mar 1, 2013
1 parent 06b3a86 commit 84cbe2f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,9 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans,
key.offset = qgroupid;

path = btrfs_alloc_path();
BUG_ON(!path);
if (!path)
return -ENOMEM;

ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (ret > 0)
ret = -ENOENT;
Expand Down Expand Up @@ -661,7 +663,9 @@ static int update_qgroup_info_item(struct btrfs_trans_handle *trans,
key.offset = qgroup->qgroupid;

path = btrfs_alloc_path();
BUG_ON(!path);
if (!path)
return -ENOMEM;

ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (ret > 0)
ret = -ENOENT;
Expand Down Expand Up @@ -702,7 +706,9 @@ static int update_qgroup_status_item(struct btrfs_trans_handle *trans,
key.offset = 0;

path = btrfs_alloc_path();
BUG_ON(!path);
if (!path)
return -ENOMEM;

ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (ret > 0)
ret = -ENOENT;
Expand Down

0 comments on commit 84cbe2f

Please sign in to comment.