From 488269629f733223adfe973fe6f7d88fe7a98e99 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 30 Jul 2021 17:53:51 +0800 Subject: [PATCH] os/bluestore: always check retval of _open_db_and_around() Signed-off-by: Kefu Chai --- src/os/bluestore/BlueStore.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 28db74787fc..9c73e981639 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6666,6 +6666,9 @@ int BlueStore::add_new_bluefs_device(int id, const string& dev_path) } r = _open_db_and_around(true); + if (r < 0) { + return r; + } if (id == BlueFS::BDEV_NEWWAL) { string p = path + "/block.wal"; @@ -6743,6 +6746,9 @@ int BlueStore::migrate_to_existing_bluefs_device(const set& devs_source, } int r = _open_db_and_around(true); + if (r < 0) { + return r; + } uint64_t used_space = 0; for(auto src_id : devs_source) { @@ -6789,7 +6795,6 @@ int BlueStore::migrate_to_new_bluefs_device(const set& devs_source, const string& dev_path) { dout(10) << __func__ << " path " << dev_path << " id:" << id << dendl; - int r; ceph_assert(path_fd < 0); ceph_assert(id == BlueFS::BDEV_NEWWAL || id == BlueFS::BDEV_NEWDB); @@ -6799,7 +6804,10 @@ int BlueStore::migrate_to_new_bluefs_device(const set& devs_source, return -EIO; } - r = _open_db_and_around(true); + int r = _open_db_and_around(true); + if (r < 0) { + return r; + } string link_db; string link_wal; -- 2.39.5