diff options
| -rw-r--r-- | fs/btrfs/extent-tree.c | 7 | ||||
| -rw-r--r-- | fs/btrfs/relocation.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/send.c | 4 |
3 files changed, 12 insertions, 1 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 | ||
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 00b7d3231821..b041b945a7ae 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
| @@ -1841,7 +1841,7 @@ again: | |||
| 1841 | old_bytenr = btrfs_node_blockptr(parent, slot); | 1841 | old_bytenr = btrfs_node_blockptr(parent, slot); |
| 1842 | blocksize = fs_info->nodesize; | 1842 | blocksize = fs_info->nodesize; |
| 1843 | old_ptr_gen = btrfs_node_ptr_generation(parent, slot); | 1843 | old_ptr_gen = btrfs_node_ptr_generation(parent, slot); |
| 1844 | btrfs_node_key_to_cpu(parent, &key, slot); | 1844 | btrfs_node_key_to_cpu(parent, &first_key, slot); |
| 1845 | 1845 | ||
| 1846 | if (level <= max_level) { | 1846 | if (level <= max_level) { |
| 1847 | eb = path->nodes[level]; | 1847 | eb = path->nodes[level]; |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 221e5cdb060b..c0074d2d7d6d 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
| @@ -5236,6 +5236,10 @@ static int send_write_or_clone(struct send_ctx *sctx, | |||
| 5236 | len = btrfs_file_extent_num_bytes(path->nodes[0], ei); | 5236 | len = btrfs_file_extent_num_bytes(path->nodes[0], ei); |
| 5237 | } | 5237 | } |
| 5238 | 5238 | ||
| 5239 | if (offset >= sctx->cur_inode_size) { | ||
| 5240 | ret = 0; | ||
| 5241 | goto out; | ||
| 5242 | } | ||
| 5239 | if (offset + len > sctx->cur_inode_size) | 5243 | if (offset + len > sctx->cur_inode_size) |
| 5240 | len = sctx->cur_inode_size - offset; | 5244 | len = sctx->cur_inode_size - offset; |
| 5241 | if (len == 0) { | 5245 | if (len == 0) { |
