Fix possible "assertion failed: pg.inflight >= 0" error during PG stop

This commit is contained in:
Vitaliy Filippov
2021-03-08 17:04:10 +03:00
parent ab21a1908b
commit 21e7686037
3 changed files with 14 additions and 12 deletions
+3 -1
View File
@@ -43,7 +43,9 @@ void osd_t::finish_op(osd_op_t *cur_op, int retval)
auto & pg = pgs.at({ .pool_id = INODE_POOL(cur_op->op_data->oid.inode), .pg_num = cur_op->op_data->pg_num });
pg.inflight--;
assert(pg.inflight >= 0);
if ((pg.state & PG_STOPPING) && pg.inflight == 0 && !pg.flush_batch)
if ((pg.state & PG_STOPPING) && pg.inflight == 0 && !pg.flush_batch &&
// We must either forget all PG's unstable writes or wait for it to become clean
dirty_pgs.find({ .pool_id = pg.pool_id, .pg_num = pg.pg_num }) == dirty_pgs.end())
{
finish_stop_pg(pg);
}