On Feb 13 2023, Qu Wenruo wrote:

> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 4aaaeab663f5..7d4095d9ca88 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -956,6 +956,7 @@ int __btrfs_map_block(struct btrfs_fs_info *fs_info, int 
> rw,
>       struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
>       struct cache_extent *ce;
>       struct map_lookup *map;
> +     u64 orig_len = *length;
>       u64 offset;
>       u64 stripe_offset;
>       u64 *raid_map = NULL;
> @@ -1047,6 +1048,7 @@ again:
>       } else {
>               *length = ce->size - offset;
>       }
> +     *length = min_t(u64, *length, orig_len);
>  
>       if (!multi_ret)
>               goto out;

I can confirm that this fixes the issue.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Reply via email to