Commit 84cbe2f7 authored by Wang Shilong's avatar Wang Shilong Committed by Josef Bacik

Btrfs: return ENOMEM rather than use BUG_ON when btrfs_alloc_path fails

Return ENOMEM rather trigger BUG_ON, fix it.
Signed-off-by: default avatarWang Shilong <wangsl-fnst@cn.fujitsu.com>
Reviewed-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Reviewed-by: default avatarZach Brown <zab@redhat.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 06b3a860
...@@ -620,7 +620,9 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, ...@@ -620,7 +620,9 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans,
key.offset = qgroupid; key.offset = qgroupid;
path = btrfs_alloc_path(); path = btrfs_alloc_path();
BUG_ON(!path); if (!path)
return -ENOMEM;
ret = btrfs_search_slot(trans, root, &key, path, 0, 1); ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (ret > 0) if (ret > 0)
ret = -ENOENT; ret = -ENOENT;
...@@ -661,7 +663,9 @@ static int update_qgroup_info_item(struct btrfs_trans_handle *trans, ...@@ -661,7 +663,9 @@ static int update_qgroup_info_item(struct btrfs_trans_handle *trans,
key.offset = qgroup->qgroupid; key.offset = qgroup->qgroupid;
path = btrfs_alloc_path(); path = btrfs_alloc_path();
BUG_ON(!path); if (!path)
return -ENOMEM;
ret = btrfs_search_slot(trans, root, &key, path, 0, 1); ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (ret > 0) if (ret > 0)
ret = -ENOENT; ret = -ENOENT;
...@@ -702,7 +706,9 @@ static int update_qgroup_status_item(struct btrfs_trans_handle *trans, ...@@ -702,7 +706,9 @@ static int update_qgroup_status_item(struct btrfs_trans_handle *trans,
key.offset = 0; key.offset = 0;
path = btrfs_alloc_path(); path = btrfs_alloc_path();
BUG_ON(!path); if (!path)
return -ENOMEM;
ret = btrfs_search_slot(trans, root, &key, path, 0, 1); ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
if (ret > 0) if (ret > 0)
ret = -ENOENT; ret = -ENOENT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment