]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: uniform allocator's error handling
authorIgor Fedotov <igor.fedotov@croit.io>
Mon, 24 Jul 2023 03:20:51 +0000 (06:20 +0300)
committerJoshua Baergen <jbaergen@digitalocean.com>
Wed, 9 Apr 2025 19:39:50 +0000 (13:39 -0600)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc

index 7d15531eaf76a1908f1fb145e90b80a6ac4a4d6b..46aee448a807c2ea169a910a2fbef079363edd48 100644 (file)
@@ -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;
index 794622ebbbd7dab12acd700affcfc3d287e5669c..87f91f7b11df4506e7b25ea21cb8dda946f60f34 100644 (file)
@@ -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;
   }