]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD::consume_map: correctly remove pg shards which are no longer acting 7577/head
authorSamuel Just <sjust@redhat.com>
Thu, 7 Jan 2016 16:09:46 +0000 (08:09 -0800)
committerLoic Dachary <ldachary@redhat.com>
Tue, 9 Feb 2016 06:33:23 +0000 (13:33 +0700)
A particular shard may be non-active even if the osd is in the acting
set.

Fixes: 14278
Backport: hammer
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit bd2fdf8c56c1aeed6cea3eb59046dbb6af470111)

src/osd/OSD.cc
src/osd/OSDMap.h

index f121a3dfbf529ebc9bfa73cc1d2a35423fc417e2..47e5e8fcbc30fa52ae96cf820f0df2ccb6d8688d 100644 (file)
@@ -6706,11 +6706,7 @@ void OSD::consume_map()
   for (set<spg_t>::iterator p = pgs_to_check.begin();
        p != pgs_to_check.end();
        ++p) {
-    vector<int> acting;
-    int nrep = osdmap->pg_to_acting_osds(p->pgid, acting);
-    int role = osdmap->calc_pg_role(whoami, acting, nrep);
-
-    if (role < 0) {
+    if (!(osdmap->is_acting_osd_shard(p->pgid, whoami, p->shard))) {
       set<Session*> concerned_sessions;
       get_sessions_possibly_interested_in_pg(*p, &concerned_sessions);
       for (set<Session*>::iterator i = concerned_sessions.begin();
index acdc3af4f2cf1d50b48f865c15ed84a3282f21a4..003f8e3c805fc6795fefc0230c99bce4cc01208b 100644 (file)
@@ -768,6 +768,15 @@ public:
       return group[group.size()-1];
     return -1;  // we fail!
   }
+  bool is_acting_osd_shard(pg_t pg, int osd, shard_id_t shard) const {
+    vector<int> acting;
+    int nrep = pg_to_acting_osds(pg, acting);
+    if (shard == shard_id_t::NO_SHARD)
+      return calc_pg_role(osd, acting, nrep) >= 0;
+    if (shard >= (int)acting.size())
+      return false;
+    return acting[shard] == osd;
+  }
 
 
   /* what replica # is a given osd? 0 primary, -1 for none. */