]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix offline device expansion in expand_devices
authorJoshua Blanch <joshua.blanch@clyso.com>
Mon, 13 Apr 2026 02:20:39 +0000 (02:20 +0000)
committerJoshua Blanch <joshua.blanch@clyso.com>
Thu, 23 Apr 2026 15:05:55 +0000 (15:05 +0000)
guard bluefs->expand_device for online-only
fixes offline expansion by reopening db from r/o to r/w
fixes int64_t/uint64_t type mismatch for old_size

Signed-off-by: Joshua Blanch <joshua.blanch@clyso.com>
src/os/bluestore/BlueStore.cc

index 9aaec54cf889a0df814620ac7249845090eb14e9..49e78cebc10987e5c439efd0212e64a54d0bf97a 100644 (file)
@@ -9251,7 +9251,7 @@ int BlueStore::expand_devices(ostream& out)
              << std::endl;
           continue;
         } else {
-          int64_t old_size = my_label.size;
+          uint64_t old_size = my_label.size;
           my_label.size = size;
           out << devid
              << " : Expanding to 0x" << std::hex << size
@@ -9266,9 +9266,12 @@ int BlueStore::expand_devices(ostream& out)
                 << " : size updated to 0x" << std::hex << size
                 << std::dec << "(" << byte_u_t(size) << ")"
                 << std::endl;
+            // online expand needs to update allocator now
+            // offline does not need this as update will happen
+            // on next open
+            if (!need_to_close)
+              bluefs->expand_device(devid, size, old_size);
           }
-          ceph_assert(mounted);
-          bluefs->expand_device(devid, size, old_size);
         }
       }
     }
@@ -9327,6 +9330,12 @@ int BlueStore::expand_devices(ostream& out)
           << std::dec << "(" << byte_u_t(size) << ")"
           << std::endl;
 
+      if (need_to_close) {
+        _close_db_and_around();
+        r = _open_db_and_around(false);
+        ceph_assert(r == 0);
+      }
+
       fm->expand(aligned_size, db);
       alloc->expand(aligned_size);
       uint64_t aligned_size0 = p2roundup(size0, min_alloc_size);