]> 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>
Fri, 15 Mar 2013 18:07:10 +0000 (11:07 -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>
src/osd/OSD.cc

index 3554ffb993ddc4a9a1a383f58aa0fe44f82f2987..daedaf28e1efc82d5d1a3b883866dbd6406bff8a 100644 (file)
@@ -205,8 +205,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;
     }
   }
@@ -4247,9 +4251,6 @@ void OSD::consume_map()
   int num_pg_primary = 0, num_pg_replica = 0, num_pg_stray = 0;
   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();
@@ -4288,6 +4289,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);