Repository navigation
Conversation
c42d929 to
65f9ccc
Compare
merge_blob() moves the csum data of the dissolved blob one pextent at a time, in whole csum chunks. So each valid pextent of that blob must start and end at a csum chunk boundary. can_merge_blob() did not check this. This can happen. With the alloc hint SEQUENTIAL_READ plus IMMUTABLE or APPEND_ONLY, _choose_write_options() picks a csum chunk larger than min_alloc_size, but the allocator still works in min_alloc_size units and _do_alloc_write() keeps its extents unchanged. On a fragmented device the blob can be split inside a csum chunk. The next clone then aborts: BlueStore.cc: FAILED ceph_assert((len % (1 << csum_chunk_order)) == 0) Removing the assert is not safe: the use tracker loop after it would add the same au once per fragment. Instead, refuse the merge. The merge is only an optimization; the caller then uses a normal shared blob. The check runs in the existing extent loop of can_merge_blob(), two compares per valid extent. Only the dissolved blob is checked, because the extents of the surviving blob are not moved. Keeping the merge for fragmented blobs would need merge_blob() to copy csum data per chunk and add the tracker only once. That is left for a follow-up. Fixes: https://tracker.ceph.com/issues/72848 Signed-off-by: Ming Lei <[email protected]>
Two cases. A blob with csum chunk aligned pextents is still merged into the shared blob next to it. A blob whose allocation is split inside a csum chunk is not merged, instead of hitting the assert in merge_blob(). Related-to: https://tracker.ceph.com/issues/72848 Signed-off-by: Ming Lei <[email protected]>
65f9ccc to
8daa8f9
Compare
|
jenkins test make check |
aclamk
left a comment
There was a problem hiding this comment.
The PR is not well targeted.
It is true that Blob::can_merge_blob() is a pre-check before Blob:merge_blob().
But there is an important assumption underlying both those function:
Both blobs must have the same blob_start.
blob_start is not a member of Blob, but can be extracted from any BlueStore::Extent that points to a Blob by blob_start().
It is true that the neither can_merge_blob() nor merge_blob() mention this blob_start requirement as a precondition.
Also please note that if blob_starts are not the same, merging is completely broken.
No. Please look at find_mergable_companion() in which ->can_merge_blob() is only called with same It is just not documented, but nothing to do with this fix. Thanks, |
|
jenkins test api |
|
jenkins test windows |
|
jenkins test make check arm64 |
|
@ming1 |
|
#72066 can solve this issue in better way, so close it. |
merge_blob()moves the csum data of the blob it dissolves one pextent at a time, in whole csum chunks. So every pextent of that blob must start and end at a csum chunk boundary.can_merge_blob()did not check this.The case is real. With the alloc hint
SEQUENTIAL_READplusIMMUTABLEorAPPEND_ONLY, the csum chunk becomes larger thanmin_alloc_size, but the allocator still works inmin_alloc_sizeunits. On a fragmented device a blob can then be split inside a csum chunk, and the next clone aborts:Removing the assert is not safe: the use tracker would count the same AU once per fragment. This PR makes
can_merge_blob()refuse such a blob instead. The merge is only an optimization; the caller then uses a normal shared blob.The unit test covers both cases: aligned blobs still merge, and a fragmented blob is refused. Without the fix it reproduces the tracker abort. The abort was also reproduced end to end on a fragmented device, through
queue_transactions()->_clone()->merge_blob(), and that run passes with the fix.Fixes: https://tracker.ceph.com/issues/72848
Checklist