Fix OSDs being unable to stop PGs that are 'peering', not 'active'

This was sometimes leading to incorrect misplaced and degraded object count statistics
Vitaliy Filippov 2021-03-06 01:57:52 +03:00
parent 07912fd670
commit 09b3e4e789
1 changed files with 6 additions and 1 deletions

View File

@ -468,10 +468,15 @@ bool osd_t::stop_pg(pg_t & pg)
delete pg.peering_state;
pg.peering_state = NULL;
}
if (!(pg.state & PG_ACTIVE))
if (pg.state & PG_STOPPING)
{
return false;
}
if (!(pg.state & PG_ACTIVE))
{
finish_stop_pg(pg);
return true;
}
pg.state = pg.state & ~PG_ACTIVE | PG_STOPPING;
if (pg.inflight == 0 && !pg.flush_batch &&
// We must either forget all PG's unstable writes or wait for it to become clean