diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d2b3a5e9a6211bb875b3db0e48ec9552a7764832..8520354f086e0754f36612fc086f7be1e8d3a25f 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3715,19 +3715,19 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans, ret = btrfs_alloc_chunk(trans, extent_root, flags); trans->allocating_chunk = false; - if (ret < 0 && ret != -ENOSPC) - goto out; spin_lock(&space_info->lock); + if (ret < 0 && ret != -ENOSPC) + goto out; if (ret) space_info->full = 1; else ret = 1; space_info->force_alloc = CHUNK_ALLOC_NO_FORCE; +out: space_info->chunk_alloc = 0; spin_unlock(&space_info->lock); -out: mutex_unlock(&fs_info->chunk_mutex); return ret; }