Commit b45a9d8b authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba

btrfs: btrfs_update_root error push-up

btrfs_update_root BUG's when it can't alloc a path, yet it can recover
from a search error. This patch returns -ENOMEM instead.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
parent 200a5c17
...@@ -2724,9 +2724,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -2724,9 +2724,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
*root, struct btrfs_key *key, struct btrfs_root_item *root, struct btrfs_key *key, struct btrfs_root_item
*item); *item);
int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root int __must_check btrfs_update_root(struct btrfs_trans_handle *trans,
*root, struct btrfs_key *key, struct btrfs_root_item struct btrfs_root *root,
*item); struct btrfs_key *key,
struct btrfs_root_item *item);
int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
btrfs_root_item *item, struct btrfs_key *key); btrfs_root_item *item, struct btrfs_key *key);
int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid); int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid);
......
...@@ -93,7 +93,9 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -93,7 +93,9 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
unsigned long ptr; unsigned long ptr;
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)
goto out; goto out;
......
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