]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix crash caused by dividing by 0 57198/head
authorjrchyang <yujrchyang@outlook.com>
Tue, 24 Oct 2023 02:03:09 +0000 (10:03 +0800)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Wed, 1 May 2024 10:32:50 +0000 (17:32 +0700)
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 <yuzhiqiang_yewu@cmss.chinamobile.com>
(cherry picked from commit 4364ebdfa4a218a61528f7579e45233cc4725326)

src/os/bluestore/BlueStore.cc

index 5346773ab5be73b597ad894890ce7615963d30a1..292e00b250e8a2378d5d965754edeef40d79ee4c 100644 (file)
@@ -5793,7 +5793,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