]> git-server-git.apps.pok.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)
committerAdam Kupczyk <akupczyk@ibm.com>
Mon, 22 Jul 2024 12:36:28 +0000 (12:36 +0000)
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>
src/os/bluestore/BlueStore.cc

index a3885e779bed2bcc6a47d4c1abe81c9efe735eb0..d213a081ddd931be7b577b91705597d3e0d057ed 100644 (file)
@@ -6665,7 +6665,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) {
@@ -6706,6 +6706,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 {