]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueStore: no device no symlink. 15721/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 16 Jun 2017 18:42:37 +0000 (02:42 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 16 Jun 2017 18:42:37 +0000 (02:42 +0800)
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 <jianpeng.ma@intel.com>
src/os/bluestore/BlueStore.cc

index 872b6f6adf997c52429388a99e2e81e0d11c382d..3c654fe2311eb3f4322852deaad28154d4256637 100644 (file)
@@ -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) {