]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMap: Populate primary_temp values a little more carefully 1111/head
authorGreg Farnum <greg@inktank.com>
Sat, 18 Jan 2014 01:23:33 +0000 (17:23 -0800)
committerGreg Farnum <greg@inktank.com>
Sat, 18 Jan 2014 05:04:30 +0000 (21:04 -0800)
In _get_temp_osds(), we populate temp_pg from the list in the OSDMap,
but we also skip anybody in the list who's down. We need to account
for those skips when setting the primary. It's easy enough to do -- just
look at the output pg_temp list instead of the OSDMap's starting one.

Fixes: #7177
Signed-off-by: Greg Farnum <greg@inktank.com>
src/osd/OSDMap.cc

index 3f7e12945bd8d4f8e5d608942a2326a203851095..5c5368a486c993eedf11cde95fd2c4c5d0e0e2f9 100644 (file)
@@ -1376,8 +1376,8 @@ void OSDMap::_get_temp_osds(const pg_pool_t& pool, pg_t pg,
   *temp_primary = -1;
   if (pp != primary_temp->end())
     *temp_primary = pp->second;
-  else if (p != pg_temp->end()) // apply pg_temp's primary
-    *temp_primary = p->second.front();
+  else if (!temp_pg->empty()) // apply pg_temp's primary
+    *temp_primary = temp_pg->front();
 }
 
 int OSDMap::pg_to_osds(pg_t pg, vector<int> *raw, int *primary) const