Bug #62282 ยป b.patch
src/test/objectstore/hybrid_allocator_test.cc | ||
---|---|---|
}
|
||
}
|
||
TEST(BitmapAllocator, claim_bad_alloc_unit)
|
||
{
|
||
uint64_t block_size = 0x10000;
|
||
uint64_t capacity = _4m;
|
||
BitmapAllocator ha(g_ceph_context, capacity, block_size,
|
||
"test_allocator");
|
||
// mark the first chunk free
|
||
ha.init_add_free(0, block_size);
|
||
// Then we simulate hybrid allocator behavior when someone is releasing
|
||
// extent starting at offset 0x14000. The master allocator will
|
||
// search for free extents adjusting the above offset on the left
|
||
// via claim_free_to_left() call.
|
||
//
|
||
// Non-zero return means that master can do the merge which is wrong
|
||
// in this scenario and when occurred within hybrid allocator it will improperly
|
||
// mark extent 0x10000~0x4000 as free. Which in turn might result in data corruption.
|
||
//
|
||
auto r = ha.claim_free_to_left(block_size + 0x4000);
|
||
ASSERT_EQ(r, 0);
|
||
}
|
||
TEST(HybridAllocator, basic)
|
||
{
|
||
{
|