]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Only accept bdev labels with our UUID
authorAdam Kupczyk <akupczyk@ibm.com>
Thu, 8 Feb 2024 14:35:29 +0000 (14:35 +0000)
committerPere Diaz Bou <pere-altea@hotmail.com>
Fri, 23 Aug 2024 09:49:24 +0000 (11:49 +0200)
This fixed the problem that some saboteur label of different UUID
with high "epoch" will trick label discovery.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
(cherry picked from commit 82b2ec7c2dd24b012e0ab66654850dc169138d8b)

src/os/bluestore/BlueStore.cc

index 21e280575c33ee933fed3bd9bd00d559a0583521..4ba67eed580856bcabac1459fc2171cac3e483c0 100644 (file)
@@ -6648,7 +6648,7 @@ int BlueStore::_read_main_bdev_label(
   for (uint64_t position : bdev_label_positions) {
     bluestore_bdev_label_t label;
     int r = _read_bdev_label(cct, path + "/block", &label, position);
-    if (r == 0) {
+    if (r == 0 && (fsid.is_zero() || label.osd_uuid == fsid)) {
       auto i = label.meta.find("multi");
       bool is_multi = i != label.meta.end() && i->second == "yes";
       if (position == BDEV_LABEL_POSITION && !is_multi) {
@@ -6689,6 +6689,9 @@ int BlueStore::_read_main_bdev_label(
           out_valid_positions->push_back(position);
         }
       }
+    } else if (r == 0) {
+      derr << __func__ << " label at 0x" << std::hex << position << std::dec
+        << " correct, but osd_uuid=" << label.osd_uuid << " need=" << fsid << dendl;
     } else if (r == 1) {
       // tried to read but no disk
     } else {