Repository navigation
os/bluestore/BlueFS: fix envelope header alignment for non-4K page hosts - #71004
Conversation
The envelope-header assert in append_try_flush() requires the memory address of a new header to mirror its file position modulo CEPH_PAGE_SIZE. CEPH_PAGE_SIZE is the host VM page size resolved at runtime, but the write path only keeps the two positions congruent at the smaller of the page size and the BlueFS block size: envelope flushes pad the on-disk stream to super.block_size, while fresh appender chunks are page-aligned allocations. On hosts whose page size exceeds the BlueFS block size (16K Apple Silicon, 64K aarch64 kernels) a block-aligned WAL position is usually not page-aligned, so the assert fires on ordinary RocksDB WAL writes and every OSD aborts at startup. Direct I/O only requires block-size memory alignment (see KernelDevice's rebuild_aligned_size_and_memory), so assert the congruence the code actually maintains: modulo min(CEPH_PAGE_SIZE, super.block_size). Also round up instead of truncating in the FileWriter appender sizing: with bluefs_alloc_size at or below the page size (e.g. 4K alloc on a 16K-page host) min_pages integer-truncated to 0, making refill() allocate nothing so append_hole() fell back to an unaligned buffer - the assert would then fire even at block-size granularity. Introduced by 4c03bbe ("os/bluestore/bluefs: Add assert if write buffer is not page aligned"); first released in v20.2.3. Fixes: https://tracker.ceph.com/issues/79141 Signed-off-by: Ming Lei <[email protected]>
Override ceph::_page_size (plus mask/shift) to simulate a host whose VM page size exceeds the BlueFS block size, then run the envelope-mode small-writes workload; a second case repeats it with bluefs_alloc_size below the simulated page size to cover the appender min_pages truncation. Before the previous commit both cases reproduced, deterministically and on any architecture, the startup abort from https://tracker.ceph.com/issues/79141: BlueFS.cc: FAILED ceph_assert(p2aligned(pos1 ^ pos2, ceph::_page_size)) Related-to: https://tracker.ceph.com/issues/79141 Signed-off-by: Ming Lei <[email protected]>
|
jenkins test make check |
2 similar comments
|
jenkins test make check |
|
jenkins test make check |
|
jenkins test make check arm64 |
|
jenkins test signed |
|
jenkins test submodules |
|
Hi @ifed01 Can you review this fix when you get time? Thanks, |
|
I feel like the problem be addressed by modifying |
Hi @aclamk Thanks for your review! I guess you meant to align BlueFS.super.block_size with max(dev_block_size, CEPH_PAGE_SIZE), this way can not work:
Please share more details if that is not what your meant. Thanks, |
Yeah, that is same issue because ppc64le doesn't take 4k page size. Your report shows that 3 bugs(207, 215, 24) of failures are same with https://tracker.ceph.com/issues/79141 Thanks, |
|
I have tested this on aarch64 with 16KB page size (on two Minisforum MS-R1 (CIX P1 CP8180) systems) with ceph 20.2.4. Works great so far. |
Thanks for the review! I am fine for the above patch. However, it increases ceph_test_bluefs test time from 6.5sec to 143sec in my VM.(16% of total time). Maybe we can figure very few generic tests for covering all related code path. |
|
Tested this patch on pppc64le and it works. |
|
@ming1 - please do not merge PRs labelled with 'need qa' before they've passed teuthology QA and relevant approval(s) |
…ge-size os/bluestore/BlueFS: fix envelope header alignment for non-4K page hosts
On hosts whose VM page size exceeds the BlueFS block size (16K Apple Silicon, 64K aarch64 kernels), every OSD with WAL v2 envelope mode enabled (the default) aborts at startup:
The assert (introduced in 4c03bbe, first released in v20.2.3) requires the envelope header's buffer address to mirror its file position modulo the runtime VM page size, but the write path only maintains that congruence modulo min(page size, block size): envelope flushes pad the on-disk stream to
super.block_size, while fresh appender chunks are page-aligned allocations. Direct I/O itself only needs block-size memory alignment, so check the congruence the code actually maintains.A second latent issue is fixed alongside: the FileWriter appender sizing integer-truncated to 0 pages when
bluefs_alloc_size<= page size, makingappend_hole()fall back to an unaligned buffer.The added tests override
ceph::_page_sizeto reproduce the abort deterministically on any architecture; both fail before the fix and pass after. Fullceph_test_bluefspasses (48/48) on two x86 hosts, plus a live-OSD smoke on real NVMe: restart on existing data (exercising WAL replay + append at an inherited offset, the field crash path) and a 4K-write bench, ~10k envelope WAL flushes, no asserts.The regression shipped in v20.2.3, so this needs a tentacle backport; squid is unaffected (no envelope mode there).
Fixes: https://tracker.ceph.com/issues/79141
Checklist