On Tue, 18 Apr 2023 15:41:55 +0900, Dominique Martinet wrote: > btrfs_read_extent_reg correctly computed the extent offset in the > BTRFS_COMPRESS_NONE case, but did not account for the 'offset - key.offset' > part correctly in the compressed case, making the function read > incorrect data. > > In the case I examined, the last 4k of a file was corrupted and > contained data from a few blocks prior, e.g. reading a 10k file with a > single extent: > btrfs_file_read() > -> btrfs_read_extent_reg > (aligned part loop, until 8k) > -> read_and_truncate_page > -> btrfs_read_extent_reg > (re-reads the last extent from 8k to the end, > incorrectly reading the first 2k of data) > > [...]
Applied to u-boot/master, thanks! -- Tom