Skip to content

btrfs: fix all bugs introduced in the compressed_folios[] removal

Qu Wenruo linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 4 repliesIn review
  2. v14 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Fix an unaligned bio size on x86_64 triggering btrfs/333 We can still have an unaligned size for the encoded write, in that case we still need to roundup the bio to fs block boundary.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: fix a bug that makes encoded write bio larger than expectedfs/btrfs/compression.c fs/btrfs/inode.c+5 -31 reply
2/4btrfs: do not touch page cache for encoded writesfs/btrfs/compression.c+7 -31 reply
3/4btrfs: fix an incorrect ASSERT() condition inside zstd_decompress_bio()fs/btrfs/zstd.c+1 -11 reply
4/4btrfs: fix an incorrect ASSERT() condition inside lzo_decompress_bio()fs/btrfs/lzo.c+2 -21 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchFilipe Manana
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] btrfs: fix all bugs introduced in the compressed_folios[] removal

[CHANGELOG]
v2:
- Fix an unaligned bio size on x86_64 triggering btrfs/333 We can still have an unaligned size for the encoded write, in that case we still need to roundup the bio to fs block boundary.

I'm a total idiot, that my usual 64K page sized arm64 VM is configured back to use 4K page size for bs > ps runs, but forgot to revert the config back.

This makes all recent arm64 runs use 4K page size, making it almost no different than x86_64 runs.

This means the recent compressed_folios[] cleanup is not really properly tested for bs < ps cases at all.
Thus all the regressions are not properly detected during the development.

In fact commit e1bc83f8b157 ("btrfs: get rid of compressed_folios[] usage for encoded writes") introduced two bugs in just one go, one can even lead to data corruption for bs < ps cases.

All bugs are caught by dded ASSERT()s, but some ASSERT()s are just incorrect in the first place, like patch 2~4.

Meanwhile the first one can lead to data corruption if CONFIG_BTRFS_ASSERT is not selected, thus it will need higher priority.

Again, very sorry for my super stupid arm64 kernel config error.

Will no longer run 4K page sized kernel on that VM any more, and deploy a new VM for 4K page sized tests, with proper kernel string suffix to indicate the page size in the future.

Qu Wenruo (4):
btrfs: fix a bug that makes encoded write bio larger than expected
btrfs: do not touch page cache for encoded writes
btrfs: fix an incorrect ASSERT() condition inside
zstd_decompress_bio()
btrfs: fix an incorrect ASSERT() condition inside lzo_decompress_bio()

 fs/btrfs/compression.c | 11 ++++++++---
 fs/btrfs/inode.c       |  7 ++++---
 fs/btrfs/lzo.c         |  4 ++--
 fs/btrfs/zstd.c        |  2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)
Signature · 1 line
2.52.0