From: Jianpeng Ma Date: Fri, 16 Jun 2017 18:42:37 +0000 (+0800) Subject: os/bluestore/BlueStore: no device no symlink. X-Git-Tag: v12.1.0~93^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=35e75bd6cd00b7a55a5e27d5a470413ffb9a449f;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 872b6f6adf99..3c654fe2311e 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) {