]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Fix repair of multilabel when collides with BlueFS 60336/head
authorAdam Kupczyk <akupczyk@ibm.com>
Tue, 15 Oct 2024 12:41:22 +0000 (12:41 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 16 Oct 2024 08:42:59 +0000 (08:42 +0000)
The problem was that BDEV_FIRST_LABEL_POSITION was removed from
bdev_label_valid_locations set.
Now, if label at BDEV_FIRST_LABEL_POSITION is valid, it is in the set.

Fixes: https://tracker.ceph.com/issues/68558
Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
(cherry picked from commit 7343be720870d4a5f82b55beee4685457a003067)

src/os/bluestore/BlueStore.cc

index c883f6fb7dba84e2fb157b7e7aeaeed0e1800d4f..206faa7bf85b4502813fed653ea589f3f0cf720f 100644 (file)
@@ -6738,9 +6738,8 @@ void BlueStore::_main_bdev_label_try_reserve()
   vector<uint64_t> candidate_positions;
   vector<uint64_t> accepted_positions;
   uint64_t lsize = std::max(BDEV_LABEL_BLOCK_SIZE, min_alloc_size);
-  for (size_t i = 1; i < bdev_label_positions.size(); i++) {
-    uint64_t location = bdev_label_positions[i];
-    if (location + lsize <= bdev->get_size()) {
+  for (uint64_t location : bdev_label_valid_locations) {
+    if (location != BDEV_FIRST_LABEL_POSITION) {
       candidate_positions.push_back(location);
     }
   }
@@ -11226,9 +11225,7 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
     string p = path + "/block";
     _write_bdev_label(cct, bdev, p, bdev_label, bdev_labels_in_repair);
     for (uint64_t pos : bdev_labels_in_repair) {
-      if (pos != BDEV_FIRST_LABEL_POSITION) {
-        bdev_label_valid_locations.push_back(pos);
-      }
+      bdev_label_valid_locations.push_back(pos);
     }
     repaired += bdev_labels_in_repair.size();
   }