mirror of
https://github.com/ceph/ceph
synced 2025-01-29 22:43:40 +00:00
OSD: _remove_pg not ruin iterator consistency
Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
311a061e0d
commit
87d1cdb5f4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user