]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make BlueStore opened by start_kv_only umountable 18082/head
authorChang Liu <liuchang0812@gmail.com>
Mon, 2 Oct 2017 16:01:43 +0000 (00:01 +0800)
committerChang Liu <liuchang0812@gmail.com>
Mon, 2 Oct 2017 16:15:44 +0000 (00:15 +0800)
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>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index f2bb4c055c8de35df34b4f59fc7cf40b26683484..5ae388a75d54d8c558390bef6da258a6c225a3da 100644 (file)
@@ -5309,6 +5309,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);
@@ -5419,23 +5421,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 0354454bc98dd49230ce550d8e7f2ecbcf864189..aae08553b0a658c898d5dde0fef7017f52ee7905 100644 (file)
@@ -1859,6 +1859,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;