From ad39d814fd819d4866e4e9f32e28f66109157b12 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 13 Oct 2011 12:47:57 -0700 Subject: [PATCH] osd: all_unfound_are_queried_or_lost The check to make isn't whether all locations are lost, but whether all locations are either lost or have been queried and don't have the object(s) we want. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 2 +- src/osd/PG.cc | 10 ++++++---- src/osd/PG.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 74c41711b2bee..15d97ef34f587 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2381,7 +2381,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector& cmd, bufferlist r = -ENOENT; goto out; } - if (!pg->all_unfound_are_lost(pg->osd->osdmap)) { + if (!pg->all_unfound_are_queried_or_lost(pg->osd->osdmap)) { ss << "pg " << pgid << " has " << unfound << " objects but we haven't probed all sources, not marking lost despite command " << cmd; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index cad2d7681abdb..3e5e5993ac0c0 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1060,13 +1060,15 @@ bool PG::adjust_need_up_thru(const OSDMap *osdmap) /* * Returns true unless there is a non-lost OSD in might_have_unfound. */ -bool PG::all_unfound_are_lost(const OSDMap* osdmap) const +bool PG::all_unfound_are_queried_or_lost(const OSDMap* osdmap) const { assert(is_primary()); set::const_iterator peer = might_have_unfound.begin(); set::const_iterator mend = might_have_unfound.end(); for (; peer != mend; ++peer) { + if (peer_missing.count(*peer)) + continue; const osd_info_t &osd_info(osdmap->get_info(*peer)); if (osd_info.lost_at <= osd_info.up_from) { // If there is even one OSD in might_have_unfound that isn't lost, we @@ -1074,8 +1076,8 @@ bool PG::all_unfound_are_lost(const OSDMap* osdmap) const return false; } } - dout(10) << "all_unfound_are_lost all of might_have_unfound " << might_have_unfound - << " are marked lost!" << dendl; + dout(10) << "all_unfound_are_queried_or_lost all of might_have_unfound " << might_have_unfound + << " have been queried or are marked lost" << dendl; return true; } @@ -4100,7 +4102,7 @@ PG::RecoveryState::Active::react(const ActMap&) { int unfound = pg->missing.num_missing() - pg->missing_loc.size(); if (unfound > 0 && - pg->all_unfound_are_lost(pg->osd->osdmap)) { + pg->all_unfound_are_queried_or_lost(pg->osd->osdmap)) { if (g_conf->osd_auto_mark_unfound_lost) { pg->osd->clog.error() << pg->info.pgid << " has " << unfound << " objects unfound and apparently lost, would automatically marking lost but NOT IMPLEMENTED\n"; diff --git a/src/osd/PG.h b/src/osd/PG.h index 7139fc0f2d337..0a562630c2459 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1401,7 +1401,7 @@ public: bool adjust_need_up_thru(const OSDMap *osdmap); - bool all_unfound_are_lost(const OSDMap* osdmap) const; + bool all_unfound_are_queried_or_lost(const OSDMap* osdmap) const; virtual void mark_all_unfound_lost() = 0; bool calc_min_last_complete_ondisk() { -- 2.39.5