]> git-server-git.apps.pok.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>
Thu, 27 Mar 2025 16:33:02 +0000 (10:33 -0600)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc

index e6e86ef489c0ec1118ea6e7245197ebc33a49f07..c232524c00071cae5538896fcd56b687067fc35e 100644 (file)
@@ -3960,8 +3960,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 83b6d6aab27809ebd69a6a5cc4be8a9a2a4ff512..f4663b5becc77ed59032ae6557dfe19c88cc70d5 100644 (file)
@@ -10966,7 +10966,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;
@@ -11383,7 +11383,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;
   }