|
@@ -3142,7 +3142,11 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
|
|
struct rb_node *node;
|
|
struct rb_node *node;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
|
|
+ spin_lock(&root->fs_info->trans_lock);
|
|
cur_trans = root->fs_info->running_transaction;
|
|
cur_trans = root->fs_info->running_transaction;
|
|
|
|
+ if (cur_trans)
|
|
|
|
+ refcount_inc(&cur_trans->use_count);
|
|
|
|
+ spin_unlock(&root->fs_info->trans_lock);
|
|
if (!cur_trans)
|
|
if (!cur_trans)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -3151,6 +3155,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
|
|
head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
|
|
head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
|
|
if (!head) {
|
|
if (!head) {
|
|
spin_unlock(&delayed_refs->lock);
|
|
spin_unlock(&delayed_refs->lock);
|
|
|
|
+ btrfs_put_transaction(cur_trans);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3167,6 +3172,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
|
|
mutex_lock(&head->mutex);
|
|
mutex_lock(&head->mutex);
|
|
mutex_unlock(&head->mutex);
|
|
mutex_unlock(&head->mutex);
|
|
btrfs_put_delayed_ref_head(head);
|
|
btrfs_put_delayed_ref_head(head);
|
|
|
|
+ btrfs_put_transaction(cur_trans);
|
|
return -EAGAIN;
|
|
return -EAGAIN;
|
|
}
|
|
}
|
|
spin_unlock(&delayed_refs->lock);
|
|
spin_unlock(&delayed_refs->lock);
|
|
@@ -3199,6 +3205,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
|
|
}
|
|
}
|
|
spin_unlock(&head->lock);
|
|
spin_unlock(&head->lock);
|
|
mutex_unlock(&head->mutex);
|
|
mutex_unlock(&head->mutex);
|
|
|
|
+ btrfs_put_transaction(cur_trans);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|