]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: don't do init_rm_free when mounting bluefs after mkfs.
authorIgor Fedotov <ifedotov@suse.com>
Fri, 11 Oct 2019 14:15:22 +0000 (17:15 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Fri, 31 Jul 2020 12:36:51 +0000 (15:36 +0300)
This is a duplicate op which might cause allocator (namely stupid one) to fail.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 4cd260b811973517d0330f0e6dd58909b7744530..9a3175b3241bf1d8300b2f72e5f0e5175ad0ce56 100644 (file)
@@ -584,6 +584,8 @@ int BlueFS::mkfs(uuid_d osd_uuid, const bluefs_layout_t& layout)
   _stop_alloc();
   _shutdown_logger();
 
+  after_mkfs = true;
+
   dout(10) << __func__ << " success" << dendl;
   return 0;
 }
@@ -650,10 +652,6 @@ void BlueFS::_stop_alloc()
       p->discard_drain();
   }
 
-  for (auto p : alloc) {
-    if (p != nullptr && p != shared_bdev_alloc) {
-    }
-  }
   for (size_t i = 0; i < alloc.size(); ++i) {
     if (alloc[i] && alloc[i] != shared_bdev_alloc) {
       alloc[i]->shutdown();
@@ -699,9 +697,13 @@ int BlueFS::mount()
   for (auto& p : file_map) {
     dout(30) << __func__ << " noting alloc for " << p.second->fnode << dendl;
     for (auto& q : p.second->fnode.extents) {
-      alloc[q.bdev]->init_rm_free(q.offset, q.length);
       if (alloc[q.bdev] == shared_bdev_alloc) {
+        if (!after_mkfs) {
+          alloc[q.bdev]->init_rm_free(q.offset, q.length);
+        }
         shared_bdev_used += q.length;
+      } else {
+        alloc[q.bdev]->init_rm_free(q.offset, q.length);
       }
     }
   }
@@ -715,6 +717,8 @@ int BlueFS::mount()
            << std::hex << log_writer->pos << std::dec
            << dendl;
 
+  after_mkfs = false;
+
   return 0;
 
  out:
index 0a2fe38c5b09bc534e974c5cddab86439155d916..edbdd94e8891a031e1dc6950b559b3a0ef171857 100644 (file)
@@ -315,6 +315,8 @@ private:
   class SocketHook;
   SocketHook* asok_hook = nullptr;
 
+  bool after_mkfs = false;
+
   void _init_logger();
   void _shutdown_logger();
   void _update_logger_stats();