From 2754c5acad442e50d97c8daf648cfcadd38222a6 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 3 Oct 2017 00:01:43 +0800 Subject: [PATCH] os/bluestore: make BlueStore opened by start_kv_only umountable 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 --- src/os/bluestore/BlueStore.cc | 25 ++++++++++++++----------- src/os/bluestore/BlueStore.h | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index f2bb4c055c8de..5ae388a75d54d 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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(); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 0354454bc98dd..aae08553b0a65 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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; -- 2.39.5