]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: osdmap: do not assert target_v when encoding under stretch mode 40484/head
authorGreg Farnum <gfarnum@redhat.com>
Tue, 30 Mar 2021 00:56:13 +0000 (00:56 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Mon, 3 May 2021 21:53:40 +0000 (21:53 +0000)
As in dd63a3e21fb6d63b8951a6542fb09f98b79b8cd6 for the OSDMap, this
caused crashes when encoding for kernel clients, and is unnecessary
for servers because they are separately gated.

I did a full audit of every instance of "assert" I added to the codebase
to make sure this is the very last one of these issues.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
(cherry picked from commit 589de8b9cbb4e9fc8e70d77a2a5f58a3049918a0)

src/mon/MonmapMonitor.cc
src/osd/OSDMap.cc

index f827a078a043935bcd719732c8e18cdab2287a02..ec72f410d1fcf230384748abc1a367052a446799 100644 (file)
@@ -1244,8 +1244,10 @@ bool MonmapMonitor::preprocess_join(MonOpRequestRef op)
     return true;
   }
 
-  if (pending_map.contains(join->name) &&
-      !pending_map.get_addrs(join->name).front().is_blank_ip()) {
+  const auto name_info_i = pending_map.mon_info.find(join->name);
+  if (name_info_i != pending_map.mon_info.end() &&
+      !name_info_i->second.public_addrs.front().is_blank_ip() &&
+      (!join->force_loc || join->crush_loc == name_info_i->second.crush_loc)) {
     dout(10) << " already have " << join->name << dendl;
     return true;
   }
@@ -1254,11 +1256,14 @@ bool MonmapMonitor::preprocess_join(MonOpRequestRef op)
     addr_name = pending_map.get_name(join->addrs);
   }
   if (!addr_name.empty() &&
-      addr_name == join->name) {
+      addr_name == join->name &&
+      (!join->force_loc || join->crush_loc.empty() ||
+       pending_map.mon_info[addr_name].crush_loc == join->crush_loc)) {
     dout(10) << " already have " << join->addrs << dendl;
     return true;
   }
   if (pending_map.stretch_mode_enabled &&
+      join->crush_loc.empty() &&
       (addr_name.empty() ||
        pending_map.mon_info[addr_name].crush_loc.empty())) {
     dout(10) << "stretch mode engaged but no source of crush_loc" << dendl;
@@ -1284,7 +1289,9 @@ bool MonmapMonitor::prepare_join(MonOpRequestRef op)
   if (pending_map.contains(join->name))
     pending_map.remove(join->name);
   pending_map.add(join->name, join->addrs);
-  pending_map.mon_info[join->name].crush_loc = existing_loc;
+  pending_map.mon_info[join->name].crush_loc =
+    ((join->force_loc || existing_loc.empty()) ?
+     join->crush_loc : existing_loc);
   pending_map.last_changed = ceph_clock_now();
   return true;
 }
index e720a5ebd1b17c6ec712e3b46d9df7da8228caac..98b4c3e1821b8f6a48a341f33b5a7ca7b72a63f3 100644 (file)
@@ -655,7 +655,6 @@ void OSDMap::Incremental::encode(ceph::buffer::list& bl, uint64_t features) cons
       target_v = 6;
     }
     if (change_stretch_mode) {
-      ceph_assert(target_v >= 9);
       target_v = std::max((uint8_t)10, target_v);
     }
     ENCODE_START(target_v, 1, bl); // extended, osd-only data