diff options
Diffstat (limited to 'fs/btrfs/root-tree.c')
-rw-r--r-- | fs/btrfs/root-tree.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 10d8e4d88071..eb923d087da7 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c | |||
@@ -141,8 +141,10 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | 142 | ||
143 | ret = btrfs_search_slot(trans, root, key, path, 0, 1); | 143 | ret = btrfs_search_slot(trans, root, key, path, 0, 1); |
144 | if (ret < 0) | 144 | if (ret < 0) { |
145 | goto out_abort; | 145 | btrfs_abort_transaction(trans, root, ret); |
146 | goto out; | ||
147 | } | ||
146 | 148 | ||
147 | if (ret != 0) { | 149 | if (ret != 0) { |
148 | btrfs_print_leaf(root, path->nodes[0]); | 150 | btrfs_print_leaf(root, path->nodes[0]); |
@@ -166,16 +168,23 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
166 | btrfs_release_path(path); | 168 | btrfs_release_path(path); |
167 | ret = btrfs_search_slot(trans, root, key, path, | 169 | ret = btrfs_search_slot(trans, root, key, path, |
168 | -1, 1); | 170 | -1, 1); |
169 | if (ret < 0) | 171 | if (ret < 0) { |
170 | goto out_abort; | 172 | btrfs_abort_transaction(trans, root, ret); |
173 | goto out; | ||
174 | } | ||
175 | |||
171 | ret = btrfs_del_item(trans, root, path); | 176 | ret = btrfs_del_item(trans, root, path); |
172 | if (ret < 0) | 177 | if (ret < 0) { |
173 | goto out_abort; | 178 | btrfs_abort_transaction(trans, root, ret); |
179 | goto out; | ||
180 | } | ||
174 | btrfs_release_path(path); | 181 | btrfs_release_path(path); |
175 | ret = btrfs_insert_empty_item(trans, root, path, | 182 | ret = btrfs_insert_empty_item(trans, root, path, |
176 | key, sizeof(*item)); | 183 | key, sizeof(*item)); |
177 | if (ret < 0) | 184 | if (ret < 0) { |
178 | goto out_abort; | 185 | btrfs_abort_transaction(trans, root, ret); |
186 | goto out; | ||
187 | } | ||
179 | l = path->nodes[0]; | 188 | l = path->nodes[0]; |
180 | slot = path->slots[0]; | 189 | slot = path->slots[0]; |
181 | ptr = btrfs_item_ptr_offset(l, slot); | 190 | ptr = btrfs_item_ptr_offset(l, slot); |
@@ -192,10 +201,6 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
192 | out: | 201 | out: |
193 | btrfs_free_path(path); | 202 | btrfs_free_path(path); |
194 | return ret; | 203 | return ret; |
195 | |||
196 | out_abort: | ||
197 | btrfs_abort_transaction(trans, root, ret); | ||
198 | goto out; | ||
199 | } | 204 | } |
200 | 205 | ||
201 | int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 206 | int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, |