]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: synchronously remove pgids when pool tombstone is missing or invalid
authorSage Weil <sage@redhat.com>
Mon, 2 Apr 2018 13:20:43 +0000 (08:20 -0500)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:26:59 +0000 (08:26 -0500)
This is needed for upgraded clusters (e.g., v13.0.2 clusters with an
missing ec_profile or upgraded clusters with partially-deleted pools/pgs).

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index dd42641bf348876cf6040baf66e6823c00e411f9..00aab28d6ae9d4c155f9fd30f005e72a349efda0 100644 (file)
@@ -3669,10 +3669,20 @@ PG* OSD::_make_pg(
     ghobject_t oid = make_final_pool_info_oid(pgid.pool());
     bufferlist bl;
     int r = store->read(service.meta_ch, oid, 0, 0, bl);
+    if (r < 0) {
+      derr << __func__ << " missing pool " << pgid.pool() << " tombstone"
+          << dendl;
+      return nullptr;
+    }
     ceph_assert(r >= 0);
     auto p = bl.begin();
     decode(pi, p);
     decode(name, p);
+    if (p.end()) { // dev release v13.0.2 did not include ec_profile
+      derr << __func__ << " missing ec_profile from pool " << pgid.pool()
+          << " tombstone" << dendl;
+      return nullptr;
+    }
     decode(ec_profile, p);
   }
   PGPool pool(cct, createmap, pgid.pool(), pi, name);
@@ -3834,6 +3844,11 @@ void OSD::load_pgs()
     } else {
       pg = _make_pg(osdmap, pgid);
     }
+    if (!pg) {
+      recursive_remove_collection(cct, store, pgid, *it);
+      continue;
+    }
+
     // there can be no waiters here, so we don't call wake_pg_waiters
 
     pg->lock();