]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make BlueStore opened by start_kv_only umountable 18750/head
authorChang Liu <liuchang0812@gmail.com>
Mon, 2 Oct 2017 16:01:43 +0000 (00:01 +0800)
committerShinobu Kinjo <shinobu@redhat.com>
Sun, 5 Nov 2017 06:28:07 +0000 (15:28 +0900)
ceph-kvstore-tool use start_kv_only to debug the kvstore. we
will get a crash when we try to umount bluestore in kvstore-tool.

Fixes: http://tracker.ceph.com/issues/21624
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
(cherry picked from commit 2754c5acad442e50d97c8daf648cfcadd38222a6)

src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 47eb571b426ca2680eeadaa129b091439019e818..34653e4ffdfe2fab3031593767b564de9b8cd373 100644 (file)
@@ -5365,6 +5365,8 @@ int BlueStore::_mount(bool kv_only)
 {
   dout(1) << __func__ << " path " << path << dendl;
 
+  _kv_only = kv_only;
+
   {
     string type;
     int r = read_meta("type", &type);
@@ -5475,23 +5477,24 @@ int BlueStore::_mount(bool kv_only)
 
 int BlueStore::umount()
 {
-  assert(mounted);
+  assert(_kv_only || mounted);
   dout(1) << __func__ << dendl;
 
   _osr_drain_all();
   _osr_unregister_all();
 
-  mempool_thread.shutdown();
-
-  dout(20) << __func__ << " stopping kv thread" << dendl;
-  _kv_stop();
-  _reap_collections();
-  _flush_cache();
-  dout(20) << __func__ << " closing" << dendl;
-
   mounted = false;
-  _close_alloc();
-  _close_fm();
+  if (!_kv_only) {
+    mempool_thread.shutdown();
+    dout(20) << __func__ << " stopping kv thread" << dendl;
+    _kv_stop();
+    _reap_collections();
+    _flush_cache();
+    dout(20) << __func__ << " closing" << dendl;
+
+    _close_alloc();
+    _close_fm();
+  }
   _close_db();
   _close_bdev();
   _close_fsid();
index df42ffa8c44da0916572b302edb23efe41817996..d07f258c5c219ca41fce3ed979407a33baff147b 100644 (file)
@@ -1858,6 +1858,7 @@ private:
   KVSyncThread kv_sync_thread;
   std::mutex kv_lock;
   std::condition_variable kv_cond;
+  bool _kv_only = false;
   bool kv_sync_started = false;
   bool kv_stop = false;
   bool kv_finalize_started = false;