]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: open db in read-only when expanding standalone DB/WAL
authorAdam Kupczyk <akupczyk@redhat.com>
Tue, 17 Mar 2020 13:56:58 +0000 (14:56 +0100)
committerIgor Fedotov <ifedotov@suse.com>
Fri, 17 Apr 2020 10:29:11 +0000 (13:29 +0300)
Replace mount() with cold_open() to force opening db in read-only mode.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 976079216cec202d47b7193d19b16f5a8578f269)

src/os/bluestore/BlueStore.cc

index 6cfee3967ef0b0301e448975e3f457a4d338cb39..0e634fb56becc5bf90b4aa956a8c5aaa64454834 100644 (file)
@@ -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;
 }