From 4364ebdfa4a218a61528f7579e45233cc4725326 Mon Sep 17 00:00:00 2001 From: jrchyang Date: Tue, 24 Oct 2023 10:03:09 +0800 Subject: [PATCH] os/bluestore: fix crash caused by dividing by 0 In Allocator::create() => ZonedAllocator::ZonedAllocator() num_zones is calculated by size / zone_size, causing a crash when zone_size is set to 0 Signed-off-by: Jrchyang Yu --- src/os/bluestore/BlueStore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ec03fcde14aea..d031b2e4c0104 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6890,7 +6890,7 @@ int BlueStore::_create_alloc() cct, cct->_conf->bluestore_allocator, bdev->get_conventional_region_size(), alloc_size, - 0, 0, + zone_size, 0, "zoned_block"); if (!a) { lderr(cct) << __func__ << " failed to create " << cct->_conf->bluestore_allocator -- 2.39.5