]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: _remove_pg not ruin iterator consistency
authorSamuel Just <sam.just@inktank.com>
Thu, 21 Jun 2012 01:55:29 +0000 (18:55 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 5 Jul 2012 17:15:02 +0000 (10:15 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc

index 1c69668bf4aeff1d44abb0c4140dfb938b0286cc..29de2935138adde07f2476d1a04a5ef72306b14f 100644 (file)
@@ -3579,6 +3579,8 @@ void OSD::activate_map()
 
   epoch_t oldest_last_clean = osdmap->get_epoch();
 
+  list<PG*> to_remove;
+
   // scan pg's
   for (hash_map<pg_t,PG*>::iterator it = pg_map.begin();
        it != pg_map.end();
@@ -3598,9 +3600,8 @@ void OSD::activate_map()
     if (!osdmap->have_pg_pool(pg->info.pgid.pool())) {
       //pool is deleted!
       pg->get();
-      _remove_pg(pg);
+      to_remove.push_back(pg);
       pg->unlock();
-      pg->put();
       continue;
     } else {
       pg->queue_null(osdmap->get_epoch(), osdmap->get_epoch());
@@ -3608,6 +3609,16 @@ void OSD::activate_map()
     pg->unlock();
   }  
 
+  
+  for (list<PG*>::iterator i = to_remove.begin();
+       i != to_remove.end();
+       ++i) {
+    (*i)->lock();
+    _remove_pg((*i));
+    (*i)->unlock();
+    (*i)->put();
+  }
+
   logger->set(l_osd_pg, pg_map.size());
   logger->set(l_osd_pg_primary, num_pg_primary);
   logger->set(l_osd_pg_replica, num_pg_replica);