From: Kefu Chai Date: Fri, 30 Jul 2021 09:53:51 +0000 (+0800) Subject: os/bluestore: always check retval of _open_db_and_around() X-Git-Tag: v17.1.0~1231^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=488269629f733223adfe973fe6f7d88fe7a98e99;p=ceph-ci.git os/bluestore: always check retval of _open_db_and_around() Signed-off-by: Kefu Chai --- 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;