Skip to content

btrfs-progs: make convert to generate chunks aligned to stripe boundary

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: convert: make sure the length of data chunks are also stripe alignedconvert/main.c+2 -10 replies
2/3btrfs-progs: add extra chunk alignment checkscheck/common.h check/main.c check/mode-lowmem.c +2 more+52 -00 replies
3/3btrfs-progs: tests: enable strict chunk alignment checktests/common tests/common.convert+4 -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: make convert to generate chunks aligned to stripe boundary

There is a recent report about scrub use-after-free, which is caused by unaligned chunk length (only aligned to sectorsize, but not to BTRFS_STRIPE_LEN).

Although the bug would soon be fixed in kernel, there is no hard to make convert to generate data chunks with both start and length aligned to BTRFS_STRIPE_LEN.

Thankfully the start bytenr is already aligned to 64K, we only need to make the length aligned.

Furthermore, allow "btrfs check" to detect such unaligned chunks and gives a warning (but not consider it as an error).
For selftests, we would utilize the debug environment variable, BTRFS_PROGS_DEBUG_STRICT_CHUNK_ALIGNMENT, to convert the warning to an error.

Qu Wenruo (3):
btrfs-progs: convert: make sure the length of data chunks are also
stripe aligned
btrfs-progs: add extra chunk alignment checks
btrfs-progs: tests: enable strict chunk alignment check

 check/common.h       |  1 +
 check/main.c         | 20 ++++++++++++++++++++
 check/mode-lowmem.c  | 11 +++++++++++
 common/utils.c       | 19 +++++++++++++++++++
 common/utils.h       |  1 +
 convert/main.c       |  3 ++-
 tests/common         |  2 ++
 tests/common.convert |  2 ++
 8 files changed, 58 insertions(+), 1 deletion(-)

--
2.43.0