diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-06-22 14:16:25 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-06-22 14:16:25 -0400 |
commit | 54aa1f4dfdacd60a19c4471220b24e581be6f774 (patch) | |
tree | 1462277822cc63c00ad31b522457363a5c6be6ab /fs/btrfs/transaction.c | |
parent | 11bd143fc8243cf48c934dc1c4479a5aacf58ce3 (diff) |
Btrfs: Audit callers and return codes to make sure -ENOSPC gets up the stack
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index b5b99a85763f..321f8852755b 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -219,7 +219,8 @@ static int add_dirty_roots(struct btrfs_trans_handle *trans, | |||
219 | struct btrfs_root *root; | 219 | struct btrfs_root *root; |
220 | int i; | 220 | int i; |
221 | int ret; | 221 | int ret; |
222 | int err; | 222 | int err = 0; |
223 | |||
223 | while(1) { | 224 | while(1) { |
224 | ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0, | 225 | ret = radix_tree_gang_lookup_tag(radix, (void **)gang, 0, |
225 | ARRAY_SIZE(gang), | 226 | ARRAY_SIZE(gang), |
@@ -251,11 +252,12 @@ static int add_dirty_roots(struct btrfs_trans_handle *trans, | |||
251 | err = btrfs_insert_root(trans, root->fs_info->tree_root, | 252 | err = btrfs_insert_root(trans, root->fs_info->tree_root, |
252 | &root->root_key, | 253 | &root->root_key, |
253 | &root->root_item); | 254 | &root->root_item); |
254 | BUG_ON(err); | 255 | if (err) |
256 | break; | ||
255 | list_add(&dirty->list, list); | 257 | list_add(&dirty->list, list); |
256 | } | 258 | } |
257 | } | 259 | } |
258 | return 0; | 260 | return err; |
259 | } | 261 | } |
260 | 262 | ||
261 | static int drop_dirty_roots(struct btrfs_root *tree_root, | 263 | static int drop_dirty_roots(struct btrfs_root *tree_root, |
@@ -263,7 +265,7 @@ static int drop_dirty_roots(struct btrfs_root *tree_root, | |||
263 | { | 265 | { |
264 | struct dirty_root *dirty; | 266 | struct dirty_root *dirty; |
265 | struct btrfs_trans_handle *trans; | 267 | struct btrfs_trans_handle *trans; |
266 | int ret; | 268 | int ret = 0; |
267 | while(!list_empty(list)) { | 269 | while(!list_empty(list)) { |
268 | mutex_lock(&tree_root->fs_info->fs_mutex); | 270 | mutex_lock(&tree_root->fs_info->fs_mutex); |
269 | dirty = list_entry(list->next, struct dirty_root, list); | 271 | dirty = list_entry(list->next, struct dirty_root, list); |
@@ -274,14 +276,15 @@ static int drop_dirty_roots(struct btrfs_root *tree_root, | |||
274 | BUG_ON(ret); | 276 | BUG_ON(ret); |
275 | 277 | ||
276 | ret = btrfs_del_root(trans, tree_root, &dirty->snap_key); | 278 | ret = btrfs_del_root(trans, tree_root, &dirty->snap_key); |
277 | BUG_ON(ret); | 279 | if (ret) |
280 | break; | ||
278 | ret = btrfs_end_transaction(trans, tree_root); | 281 | ret = btrfs_end_transaction(trans, tree_root); |
279 | BUG_ON(ret); | 282 | BUG_ON(ret); |
280 | kfree(dirty); | 283 | kfree(dirty); |
281 | mutex_unlock(&tree_root->fs_info->fs_mutex); | 284 | mutex_unlock(&tree_root->fs_info->fs_mutex); |
282 | btrfs_btree_balance_dirty(tree_root); | 285 | btrfs_btree_balance_dirty(tree_root); |
283 | } | 286 | } |
284 | return 0; | 287 | return ret; |
285 | } | 288 | } |
286 | 289 | ||
287 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | 290 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
@@ -321,9 +324,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
321 | } | 324 | } |
322 | finish_wait(&trans->transaction->writer_wait, &wait); | 325 | finish_wait(&trans->transaction->writer_wait, &wait); |
323 | WARN_ON(cur_trans != trans->transaction); | 326 | WARN_ON(cur_trans != trans->transaction); |
324 | add_dirty_roots(trans, &root->fs_info->fs_roots_radix, &dirty_fs_roots); | 327 | ret = add_dirty_roots(trans, &root->fs_info->fs_roots_radix, |
328 | &dirty_fs_roots); | ||
329 | BUG_ON(ret); | ||
330 | |||
325 | ret = btrfs_commit_tree_roots(trans, root); | 331 | ret = btrfs_commit_tree_roots(trans, root); |
326 | BUG_ON(ret); | 332 | BUG_ON(ret); |
333 | |||
327 | cur_trans = root->fs_info->running_transaction; | 334 | cur_trans = root->fs_info->running_transaction; |
328 | root->fs_info->running_transaction = NULL; | 335 | root->fs_info->running_transaction = NULL; |
329 | if (cur_trans->list.prev != &root->fs_info->trans_list) { | 336 | if (cur_trans->list.prev != &root->fs_info->trans_list) { |