From 46e79f33068c9a6eadc77cbc20d8d53b096c23c7 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 28 Feb 2021 19:34:39 +0300 Subject: [PATCH] Wait for PGs to become clean before stopping them --- src/osd_peering.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osd_peering.cpp b/src/osd_peering.cpp index b99194aa..092af810 100644 --- a/src/osd_peering.cpp +++ b/src/osd_peering.cpp @@ -473,7 +473,9 @@ bool osd_t::stop_pg(pg_t & pg) return false; } pg.state = pg.state & ~PG_ACTIVE | PG_STOPPING; - if (pg.inflight == 0 && !pg.flush_batch) + if (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); }