]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix load_pgs handling of pg dirs without a head
authorSage Weil <sage@inktank.com>
Sat, 9 Feb 2013 08:04:29 +0000 (00:04 -0800)
committerSage Weil <sage@inktank.com>
Sat, 9 Feb 2013 17:40:54 +0000 (09:40 -0800)
If there is a pgid that passes coll_t::is_pg() but there is no head, we
will populate the pgs map but then fail later when we try to do
read_state.  This is a side-effect of 55f8579.

Take explicit note of _head collections we see, and then warn when we
find stray snap collections.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc

index 8d10734552a182146e72c3324f304c7b4391150d..a0c2cce0ecd695fb74f67b10faaafa1d3160b33e 100644 (file)
@@ -1518,6 +1518,7 @@ void OSD::load_pgs()
     derr << "failed to list pgs: " << cpp_strerror(-r) << dendl;
   }
 
+  set<pg_t> head_pgs;
   map<pg_t, interval_set<snapid_t> > pgs;
   for (vector<coll_t>::iterator it = ls.begin();
        it != ls.end();
@@ -1556,6 +1557,7 @@ void OSD::load_pgs()
       continue;
     }
     pgs[pgid];
+    head_pgs.insert(pgid);
   }
 
   for (map<pg_t, interval_set<snapid_t> >::iterator i = pgs.begin();
@@ -1563,6 +1565,12 @@ void OSD::load_pgs()
        ++i) {
     pg_t pgid(i->first);
 
+    if (!head_pgs.count(pgid)) {
+      dout(10) << __func__ << ": " << pgid << " has orphan snap collections " << i->second
+              << " with no head" << dendl;
+      continue;
+    }
+
     if (!osdmap->have_pg_pool(pgid.pool())) {
       dout(10) << __func__ << ": skipping PG " << pgid << " because we don't have pool "
               << pgid.pool() << dendl;