From 2d6dca32ef3dd183e0d3aa591dfdb0896855248e Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Mon, 24 Jul 2023 06:20:51 +0300 Subject: [PATCH] os/bluestore: uniform allocator's error handling Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueFS.cc | 3 ++- src/os/bluestore/BlueStore.cc | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 7d15531eaf76a..46aee448a807c 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -3904,8 +3904,9 @@ int BlueFS::_allocate(uint8_t id, uint64_t len, } if (alloc_len < 0 || alloc_len < need) { if (alloc[id]) { - if (alloc_len > 0) { + if (extents.size()) { alloc[id]->release(extents); + extents.clear(); } if (!was_cooldown && shared) { auto delay_s = cct->_conf->bluefs_failed_shared_alloc_cooldown; diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 794622ebbbd7d..87f91f7b11df4 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -9897,7 +9897,7 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair) << " min_alloc_size 0x" << min_alloc_size << " available 0x " << alloc->get_free() << std::dec << dendl; - if (alloc_len > 0) { + if (exts.size()) { alloc->release(exts); } bypass_rest = true; @@ -10359,7 +10359,7 @@ void BlueStore::inject_leaked(uint64_t len) PExtentVector exts; int64_t alloc_len = alloc->allocate(len, min_alloc_size, min_alloc_size * 256, 0, &exts); - + ceph_assert(alloc_len >= 0); // generally we do not expect any errors if (fm->is_null_manager()) { return; } -- 2.39.5