From: Joshua Blanch Date: Mon, 13 Apr 2026 02:20:39 +0000 (+0000) Subject: os/bluestore: fix offline device expansion in expand_devices X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=439e1b04dfb12fbf5633b893620d697dc614b78d;p=ceph.git os/bluestore: fix offline device expansion in expand_devices 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 9aaec54cf88..49e78cebc10 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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);