aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2011-10-03 23:22:44 -0400
committerDavid Sterba <dsterba@suse.cz>2012-03-21 20:45:33 -0400
commitb45a9d8b48e5ce534bd222007c43cbf374544f0b (patch)
treedd08cdb5dd7657a2b6f285246415e777d19e5b86
parent200a5c17677e1ee8b78382046f3748c9f5816281 (diff)
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: Jeff Mahoney <jeffm@suse.com>
-rw-r--r--fs/btrfs/ctree.h7
-rw-r--r--fs/btrfs/root-tree.c4
2 files changed, 7 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index a97a67089755..339e637ab272 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2724,9 +2724,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2724int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root 2724int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
2725 *root, struct btrfs_key *key, struct btrfs_root_item 2725 *root, struct btrfs_key *key, struct btrfs_root_item
2726 *item); 2726 *item);
2727int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root 2727int __must_check btrfs_update_root(struct btrfs_trans_handle *trans,
2728 *root, struct btrfs_key *key, struct btrfs_root_item 2728 struct btrfs_root *root,
2729 *item); 2729 struct btrfs_key *key,
2730 struct btrfs_root_item *item);
2730int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct 2731int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
2731 btrfs_root_item *item, struct btrfs_key *key); 2732 btrfs_root_item *item, struct btrfs_key *key);
2732int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid); 2733int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid);
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 1fd93d63707f..1486cf9de1da 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -93,7 +93,9 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
93 unsigned long ptr; 93 unsigned long ptr;
94 94
95 path = btrfs_alloc_path(); 95 path = btrfs_alloc_path();
96 BUG_ON(!path); 96 if (!path)
97 return -ENOMEM;
98
97 ret = btrfs_search_slot(trans, root, key, path, 0, 1); 99 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
98 if (ret < 0) 100 if (ret < 0)
99 goto out; 101 goto out;