diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index cba2ac371ce014a6a194fe64e1f9757039332bce..baad81c1f9a35fde384d0e45cdd7456269f8d838 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -3026,9 +3026,12 @@ static int btrfs_zero_range(struct inode *inode, unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, &cached_state); /* btrfs_prealloc_file_range releases reserved space on error */ - if (ret) + if (ret) { space_reserved = false; + goto out; + } } + ret = btrfs_fallocate_update_isize(inode, offset + len, mode); out: if (ret && space_reserved) btrfs_free_reserved_data_space(inode, data_reserved,