summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-02-09 00:04:29 -0800
committerSamuel Just <sam.just@inktank.com>2013-03-19 10:43:18 -0700
commit0a09be99f3e9d2b68a052ff63ea858a7c8e5626c (patch)
tree028cb42e2d1eab2191a2df7b2dc2b1b42f3c1aa3
parent2dc25dfd47de8d3602bdb3699c82b8b118b0fb28 (diff)
downloadceph-0a09be99f3e9d2b68a052ff63ea858a7c8e5626c.tar.gz
osd: fix load_pgs handling of pg dirs without a head
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> (cherry picked from commit 1f80a0b576c0af1931f743ad988b6293cbf2d6d9)
-rw-r--r--src/osd/OSD.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 4e44207ddc5..cd5cd846871 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -1483,6 +1483,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();
@@ -1521,6 +1522,7 @@ void OSD::load_pgs()
continue;
}
pgs[pgid];
+ head_pgs.insert(pgid);
}
for (map<pg_t, interval_set<snapid_t> >::iterator i = pgs.begin();
@@ -1528,6 +1530,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;