]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: handle the case where we resurrected an old, deleted pg 4539/head
authorSamuel Just <sjust@redhat.com>
Tue, 21 Apr 2015 06:45:57 +0000 (23:45 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 1 May 2015 13:38:12 +0000 (06:38 -0700)
Prior to giant, we would skip pgs in load_pgs which were not present in
the current osdmap.  Those pgs would eventually refer to very old
osdmaps, which we no longer have causing the assertion failure in 11429
once the osd is finally upgraded to a version which does not skip the
pgs.  Instead, if we do not have the map for the pg epoch, complain to
the osd log and skip the pg.

Fixes: 11429
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/OSD.cc

index 933d35daaf22220716396e6316dd05b0dc1aa451..88c769e2ae2de5b21b884b79556bf0d032a8d8ab 100644 (file)
@@ -2770,7 +2770,28 @@ void OSD::load_pgs()
     bufferlist bl;
     epoch_t map_epoch = PG::peek_map_epoch(store, pgid, &bl);
 
-    PG *pg = _open_lock_pg(map_epoch == 0 ? osdmap : service.get_map(map_epoch), pgid);
+    PG *pg = NULL;
+    if (map_epoch > 0) {
+      OSDMapRef pgosdmap = service.try_get_map(map_epoch);
+      if (!pgosdmap) {
+       if (!osdmap->have_pg_pool(pgid.pool())) {
+         derr << __func__ << ": could not find map for epoch " << map_epoch
+              << " on pg " << pgid << ", but the pool is not present in the "
+              << "current map, so this is probably a result of bug 10617.  "
+              << "Skipping the pg for now, you can use ceph_objectstore_tool "
+              << "to clean it up later." << dendl;
+         continue;
+       } else {
+         derr << __func__ << ": have pgid " << pgid << " at epoch "
+              << map_epoch << ", but missing map.  Crashing."
+              << dendl;
+         assert(0 == "Missing map in load_pgs");
+       }
+      }
+      pg = _open_lock_pg(pgosdmap, pgid);
+    } else {
+      pg = _open_lock_pg(osdmap, pgid);
+    }
     // there can be no waiters here, so we don't call wake_pg_waiters
 
     // read pg state, log