diff options
Diffstat (limited to 'fs/btrfs/transaction.c')
| -rw-r--r-- | fs/btrfs/transaction.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 88f866f85e7a..0b8f36d4400a 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -186,6 +186,9 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root, | |||
| 186 | h->alloc_exclude_start = 0; | 186 | h->alloc_exclude_start = 0; |
| 187 | h->delayed_ref_updates = 0; | 187 | h->delayed_ref_updates = 0; |
| 188 | 188 | ||
| 189 | if (!current->journal_info) | ||
| 190 | current->journal_info = h; | ||
| 191 | |||
| 189 | root->fs_info->running_transaction->use_count++; | 192 | root->fs_info->running_transaction->use_count++; |
| 190 | record_root_in_trans(h, root); | 193 | record_root_in_trans(h, root); |
| 191 | mutex_unlock(&root->fs_info->trans_mutex); | 194 | mutex_unlock(&root->fs_info->trans_mutex); |
| @@ -317,6 +320,9 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
| 317 | wake_up(&cur_trans->writer_wait); | 320 | wake_up(&cur_trans->writer_wait); |
| 318 | put_transaction(cur_trans); | 321 | put_transaction(cur_trans); |
| 319 | mutex_unlock(&info->trans_mutex); | 322 | mutex_unlock(&info->trans_mutex); |
| 323 | |||
| 324 | if (current->journal_info == trans) | ||
| 325 | current->journal_info = NULL; | ||
| 320 | memset(trans, 0, sizeof(*trans)); | 326 | memset(trans, 0, sizeof(*trans)); |
| 321 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | 327 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
| 322 | 328 | ||
| @@ -743,6 +749,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
| 743 | memcpy(&pending->root_key, &key, sizeof(key)); | 749 | memcpy(&pending->root_key, &key, sizeof(key)); |
| 744 | fail: | 750 | fail: |
| 745 | kfree(new_root_item); | 751 | kfree(new_root_item); |
| 752 | btrfs_unreserve_metadata_space(root, 6); | ||
| 746 | return ret; | 753 | return ret; |
| 747 | } | 754 | } |
| 748 | 755 | ||
| @@ -1059,6 +1066,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
| 1059 | 1066 | ||
| 1060 | mutex_unlock(&root->fs_info->trans_mutex); | 1067 | mutex_unlock(&root->fs_info->trans_mutex); |
| 1061 | 1068 | ||
| 1069 | if (current->journal_info == trans) | ||
| 1070 | current->journal_info = NULL; | ||
| 1071 | |||
| 1062 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | 1072 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
| 1063 | return ret; | 1073 | return ret; |
| 1064 | } | 1074 | } |
