From fe6e7eb1127a2098fc2245cdc01ab6b0fdd3d4c4 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Tue, 30 Jan 2024 12:45:05 +0000 Subject: [PATCH] os/bluestore: Fix read_meta and write_meta Remove asserts if optional reading of bdev label fails. Pass all valid bdev locations when writing bdev labels. Signed-off-by: Adam Kupczyk (cherry picked from commit c0bd6fff41ba0c7e5d7a7fe9c7bfc5fa7b90beb4) --- src/os/bluestore/BlueStore.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index f6fd2b3331a..65705e87f6d 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6007,16 +6007,15 @@ int BlueStore::write_meta(const std::string& key, const std::string& value) { string p = path + "/block"; if (bdev_label_valid_locations.empty()) { - int r = _read_main_bdev_label(cct, p, &bdev_label, + _read_main_bdev_label(cct, p, &bdev_label, &bdev_label_valid_locations, &bdev_label_multi, &bdev_label_epoch); - ceph_assert(r == 0); } if (!bdev_label_valid_locations.empty()) { bdev_label.meta[key] = value; if (bdev_label_multi) { bdev_label.meta["epoch"] = std::to_string(bdev_label_epoch); } - int r = _write_bdev_label(cct, p, bdev_label); + int r = _write_bdev_label(cct, p, bdev_label, bdev_label_valid_locations); ceph_assert(r == 0); } return ObjectStore::write_meta(key, value); @@ -6026,9 +6025,8 @@ int BlueStore::read_meta(const std::string& key, std::string *value) { string p = path + "/block"; if (bdev_label_valid_locations.empty()) { - int r = _read_main_bdev_label(cct, p, &bdev_label, + _read_main_bdev_label(cct, p, &bdev_label, &bdev_label_valid_locations, &bdev_label_multi, &bdev_label_epoch); - ceph_assert(r == 0); } if (!bdev_label_valid_locations.empty()) { auto i = bdev_label.meta.find(key); -- 2.39.5