diff options
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8da29e8e4de1..36422254ef67 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -73,8 +73,10 @@ loop: | |||
73 | 73 | ||
74 | cur_trans = root->fs_info->running_transaction; | 74 | cur_trans = root->fs_info->running_transaction; |
75 | if (cur_trans) { | 75 | if (cur_trans) { |
76 | if (cur_trans->aborted) | 76 | if (cur_trans->aborted) { |
77 | spin_unlock(&root->fs_info->trans_lock); | ||
77 | return cur_trans->aborted; | 78 | return cur_trans->aborted; |
79 | } | ||
78 | atomic_inc(&cur_trans->use_count); | 80 | atomic_inc(&cur_trans->use_count); |
79 | atomic_inc(&cur_trans->num_writers); | 81 | atomic_inc(&cur_trans->num_writers); |
80 | cur_trans->num_joined++; | 82 | cur_trans->num_joined++; |
@@ -480,6 +482,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
480 | struct btrfs_transaction *cur_trans = trans->transaction; | 482 | struct btrfs_transaction *cur_trans = trans->transaction; |
481 | struct btrfs_fs_info *info = root->fs_info; | 483 | struct btrfs_fs_info *info = root->fs_info; |
482 | int count = 0; | 484 | int count = 0; |
485 | int err = 0; | ||
483 | 486 | ||
484 | if (--trans->use_count) { | 487 | if (--trans->use_count) { |
485 | trans->block_rsv = trans->orig_rsv; | 488 | trans->block_rsv = trans->orig_rsv; |
@@ -532,18 +535,18 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
532 | 535 | ||
533 | if (current->journal_info == trans) | 536 | if (current->journal_info == trans) |
534 | current->journal_info = NULL; | 537 | current->journal_info = NULL; |
535 | memset(trans, 0, sizeof(*trans)); | ||
536 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | ||
537 | 538 | ||
538 | if (throttle) | 539 | if (throttle) |
539 | btrfs_run_delayed_iputs(root); | 540 | btrfs_run_delayed_iputs(root); |
540 | 541 | ||
541 | if (trans->aborted || | 542 | if (trans->aborted || |
542 | root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { | 543 | root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { |
543 | return -EIO; | 544 | err = -EIO; |
544 | } | 545 | } |
545 | 546 | ||
546 | return 0; | 547 | memset(trans, 0, sizeof(*trans)); |
548 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | ||
549 | return err; | ||
547 | } | 550 | } |
548 | 551 | ||
549 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 552 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
@@ -1399,6 +1402,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1399 | ret = commit_fs_roots(trans, root); | 1402 | ret = commit_fs_roots(trans, root); |
1400 | if (ret) { | 1403 | if (ret) { |
1401 | mutex_unlock(&root->fs_info->tree_log_mutex); | 1404 | mutex_unlock(&root->fs_info->tree_log_mutex); |
1405 | mutex_unlock(&root->fs_info->reloc_mutex); | ||
1402 | goto cleanup_transaction; | 1406 | goto cleanup_transaction; |
1403 | } | 1407 | } |
1404 | 1408 | ||
@@ -1410,6 +1414,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1410 | ret = commit_cowonly_roots(trans, root); | 1414 | ret = commit_cowonly_roots(trans, root); |
1411 | if (ret) { | 1415 | if (ret) { |
1412 | mutex_unlock(&root->fs_info->tree_log_mutex); | 1416 | mutex_unlock(&root->fs_info->tree_log_mutex); |
1417 | mutex_unlock(&root->fs_info->reloc_mutex); | ||
1413 | goto cleanup_transaction; | 1418 | goto cleanup_transaction; |
1414 | } | 1419 | } |
1415 | 1420 | ||