Skip to content

btrfs-progs: Detect compressed extent without csum

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: check/lowmem: Add checks for compressed extent without csumcheck/mode-lowmem.c+18 -00 replies
2/3btrfs-progs: check/original: Add checks for compressed extent without csumcheck/main.c+8 -20 replies
3/3btrfs-progs: fsck-tests: Add test case for detecting compressed extent without csumtests/fsck-tests/032-compressed-nodatasum/compressed_extent_without_csum.raw.xz tests/fsck-tests/032-compressed-nodatasum/test.sh+24 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs-progs: Detect compressed extent without csum

Patches can be fetch from github:
https://github.com/adam900710/btrfs-progs/tree/compress_nodatasum

It's based on v4.16 stable branch.

James Harvey from mail list reports a strange kernel panic, whichs show obviously kernel memory corruption, while after btrfs decompression failure.

It turns out that, some compressed extent get corrupted on-disk, while the inode has NODATASUM set, there is no csum to prevent corrupted mirror being used.

Although the root cause should be buggy lzo implementation, it still shows that btrfs is not following the behavior defined in btrfs(5):

Note
If nodatacow or nodatasum are enabled, compression is disabled.

So at least make btrfs check to detect such problem.

Qu Wenruo (3):
btrfs-progs: check/lowmem: Add checks for compressed extent without
csum
btrfs-progs: check/original: Add checks for compressed extent without
csum
btrfs-progs: fsck-tests: Add test case for detecting compressed extent
without csum

 check/main.c                                  |  10 ++++++--
 check/mode-lowmem.c                           |  18 +++++++++++++
 .../compressed_extent_without_csum.raw.xz     | Bin 0 -> 21996 bytes
 .../032-compressed-nodatasum/test.sh          |  24 ++++++++++++++++++
 4 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 tests/fsck-tests/032-compressed-nodatasum/compressed_extent_without_csum.raw.xz
 create mode 100755 tests/fsck-tests/032-compressed-nodatasum/test.sh
Signature · 1 line
2.17.0