diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 6daa7bb027fc..2ae5a9b2f951 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1061,6 +1061,12 @@ static void compress_file_range(struct btrfs_work *work) mapping_set_error(mapping, -EIO); return; } + /* + * If a single block at file offset 0 cannot be inlined, fall back to + * regular writes without marking the file incompressible. + */ + if (start == 0 && end <= blocksize) + goto cleanup_and_bail_uncompressed; /* * We aren't doing an inline extent. Round the compressed size up to a