diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e2f16b68fcbf..51b5e2da708c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3142,7 +3142,11 @@ static noinline int check_delayed_ref(struct btrfs_root *root, | |||
3142 | struct rb_node *node; | 3142 | struct rb_node *node; |
3143 | int ret = 0; | 3143 | int ret = 0; |
3144 | 3144 | ||
3145 | spin_lock(&root->fs_info->trans_lock); | ||
3145 | cur_trans = root->fs_info->running_transaction; | 3146 | cur_trans = root->fs_info->running_transaction; |
3147 | if (cur_trans) | ||
3148 | refcount_inc(&cur_trans->use_count); | ||
3149 | spin_unlock(&root->fs_info->trans_lock); | ||
3146 | if (!cur_trans) | 3150 | if (!cur_trans) |
3147 | return 0; | 3151 | return 0; |
3148 | 3152 | ||
@@ -3151,6 +3155,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root, | |||
3151 | head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); | 3155 | head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); |
3152 | if (!head) { | 3156 | if (!head) { |
3153 | spin_unlock(&delayed_refs->lock); | 3157 | spin_unlock(&delayed_refs->lock); |
3158 | btrfs_put_transaction(cur_trans); | ||
3154 | return 0; | 3159 | return 0; |
3155 | } | 3160 | } |
3156 | 3161 | ||
@@ -3167,6 +3172,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root, | |||
3167 | mutex_lock(&head->mutex); | 3172 | mutex_lock(&head->mutex); |
3168 | mutex_unlock(&head->mutex); | 3173 | mutex_unlock(&head->mutex); |
3169 | btrfs_put_delayed_ref_head(head); | 3174 | btrfs_put_delayed_ref_head(head); |
3175 | btrfs_put_transaction(cur_trans); | ||
3170 | return -EAGAIN; | 3176 | return -EAGAIN; |
3171 | } | 3177 | } |
3172 | spin_unlock(&delayed_refs->lock); | 3178 | spin_unlock(&delayed_refs->lock); |
@@ -3199,6 +3205,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root, | |||
3199 | } | 3205 | } |
3200 | spin_unlock(&head->lock); | 3206 | spin_unlock(&head->lock); |
3201 | mutex_unlock(&head->mutex); | 3207 | mutex_unlock(&head->mutex); |
3208 | btrfs_put_transaction(cur_trans); | ||
3202 | return ret; | 3209 | return ret; |
3203 | } | 3210 | } |
3204 | 3211 | ||