From 35e75bd6cd00b7a55a5e27d5a470413ffb9a449f Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Sat, 17 Jun 2017 02:42:37 +0800 Subject: [PATCH] os/bluestore/BlueStore: no device no symlink. If bluestore_block_db_create or bluestore_block_db_create is false and we use non-exist blockdevice as db/wal. ceph-osd still work and it use block as db/wal. This bug introduced by 316810d7e74. If stat(symlink) error and symlink still exist, this is bug. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 872b6f6adf997..3c654fe2311eb 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4317,8 +4317,13 @@ int BlueStore::_open_db(bool create) } bluefs_shared_bdev = BlueFS::BDEV_SLOW; bluefs_single_shared_device = false; - } else { + } else if (::lstat(bfn.c_str(), &st) == -1) { bluefs_shared_bdev = BlueFS::BDEV_DB; + } else { + //symlink exist is bug + derr << __func__ << " " << bfn << " link target doesn't exist" << dendl; + r = -errno; + goto free_bluefs; } // shared device @@ -4373,8 +4378,13 @@ int BlueStore::_open_db(bool create) } cct->_conf->set_val("rocksdb_separate_wal_dir", "true"); bluefs_single_shared_device = false; - } else { + } else if (::lstat(bfn.c_str(), &st) == -1) { cct->_conf->set_val("rocksdb_separate_wal_dir", "false"); + } else { + //symlink exist is bug + derr << __func__ << " " << bfn << " link target doesn't exist" << dendl; + r = -errno; + goto free_bluefs; } if (create) { -- 2.39.5