]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: expand_pg_num after pg removes
authorSamuel Just <sam.just@inktank.com>
Fri, 15 Mar 2013 01:52:02 +0000 (18:52 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 19 Mar 2013 17:32:00 +0000 (10:32 -0700)
Otherwise:
1) expand_pg_num removes a splitting pg entry
2) peering thread grabs pg lock and starts split
3) OSD::consume_map grabs pg lock and starts removal

At step 2), we run afoul of the assert(is_splitting)
check in split_pgs.  This way, the would be splitting
pg is marked as removed prior to the splitting state
being updated.

Backport: bobtail
Fixes: #4449
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit f1b031b3cf195cf6df3d3c47c7d606fba63ed4c4)

src/osd/OSD.cc

index d814e3690767a607078549cb2c12f2f5e0887eb2..d042bc10908e9c6ee1e0b9014885e289394adf15 100644 (file)
@@ -202,8 +202,12 @@ void OSDService::expand_pg_num(OSDMapRef old_map,
     if (!new_map->have_pg_pool(i->pool())) {
       in_progress_splits.erase(i++);
     } else {
-      i->is_split(old_map->get_pg_num(i->pool()),
-                 new_map->get_pg_num(i->pool()), &children);
+      if (i->ps() < static_cast<unsigned>(old_map->get_pg_num(i->pool()))) {
+       i->is_split(old_map->get_pg_num(i->pool()),
+                   new_map->get_pg_num(i->pool()), &children);
+      } else {
+       assert(i->ps() < static_cast<unsigned>(new_map->get_pg_num(i->pool())));
+      }
       ++i;
     }
   }
@@ -4207,9 +4211,6 @@ void OSD::consume_map()
 
   list<PG*> to_remove;
 
-  service.expand_pg_num(service.get_osdmap(),
-                       osdmap);
-
   // scan pg's
   for (hash_map<pg_t,PG*>::iterator it = pg_map.begin();
        it != pg_map.end();
@@ -4251,6 +4252,8 @@ void OSD::consume_map()
   }
   to_remove.clear();
 
+  service.expand_pg_num(service.get_osdmap(), osdmap);
+
   service.pre_publish_map(osdmap);
   service.publish_map(osdmap);