From 61e6ea78ba705ff82e542e01929462c02462d087 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Tue, 17 Mar 2020 14:56:58 +0100 Subject: [PATCH] os/bluestore: open db in read-only when expanding standalone DB/WAL Replace mount() with cold_open() to force opening db in read-only mode. Signed-off-by: Adam Kupczyk Signed-off-by: Igor Fedotov (cherry picked from commit 976079216cec202d47b7193d19b16f5a8578f269) --- src/os/bluestore/BlueStore.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 6cfee3967ef0b..0e634fb56becc 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6792,10 +6792,10 @@ string BlueStore::get_device_path(unsigned id) int BlueStore::expand_devices(ostream& out) { - int r = _mount(false); + int r = cold_open(); ceph_assert(r == 0); bluefs->dump_block_extents(out); - out << "Expanding..." << std::endl; + out << "Expanding DB/WAL..." << std::endl; for (auto devid : { BlueFS::BDEV_WAL, BlueFS::BDEV_DB}) { if (devid == bluefs_layout.shared_bdev ) { continue; @@ -6843,13 +6843,18 @@ int BlueStore::expand_devices(ostream& out) } uint64_t size0 = fm->get_size(); uint64_t size = bdev->get_size(); + cold_close(); if (size0 < size) { + out << "Expanding Main..." << std::endl; + int r = _mount(false); + ceph_assert(r == 0); + out << bluefs_layout.shared_bdev <<" : expanding " << " from 0x" << std::hex << size0 << " to 0x" << size << std::dec << std::endl; KeyValueDB::Transaction txn; txn = db->get_transaction(); - int r = fm->expand(size, txn); + r = fm->expand(size, txn); ceph_assert(r == 0); db->submit_transaction_sync(txn); @@ -6874,8 +6879,8 @@ int BlueStore::expand_devices(ostream& out) << std::endl; } } + umount(); } - umount(); return r; } -- 2.39.5