From: Wang Shilong Date: Wed, 27 Feb 2013 11:20:56 +0000 (+0000) Subject: Btrfs: return ENOMEM rather than use BUG_ON when btrfs_alloc_path fails X-Git-Tag: v3.9-rc1~17^2~6 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=84cbe2f725f59b72fffb48ab7161e771eeee5103;p=~emulex%2Finfiniband.git Btrfs: return ENOMEM rather than use BUG_ON when btrfs_alloc_path fails Return ENOMEM rather trigger BUG_ON, fix it. Signed-off-by: Wang Shilong Reviewed-by: Miao Xie Reviewed-by: Zach Brown Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index f011d9b8ffb..69fa487e29c 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -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; @@ -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; @@ -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;