From: Samuel Just Date: Sat, 1 Oct 2022 20:01:36 +0000 (-0700) Subject: crimson/osd/pg_map: fix pg_creating removal order X-Git-Tag: v18.1.0~1069^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48511427202b9fc6ba1b9bb721b98c4559e95d1f;p=ceph.git crimson/osd/pg_map: fix pg_creating removal order Simpler to fulfill the promise only after restoring the pg_creating/pgs invariant. Signed-off-by: Samuel Just --- diff --git a/src/crimson/osd/pg_map.cc b/src/crimson/osd/pg_map.cc index d291419dd37d..8a6e5995daf2 100644 --- a/src/crimson/osd/pg_map.cc +++ b/src/crimson/osd/pg_map.cc @@ -64,10 +64,11 @@ void PGMap::pg_created(spg_t pgid, Ref pg) ceph_assert(!pgs.count(pgid)); pgs.emplace(pgid, pg); - auto state = pgs_creating.find(pgid); - ceph_assert(state != pgs_creating.end()); - state->second.promise.set_value(pg); - pgs_creating.erase(pgid); + auto creating_iter = pgs_creating.find(pgid); + ceph_assert(creating_iter != pgs_creating.end()); + auto promise = std::move(creating_iter->second.promise); + pgs_creating.erase(creating_iter); + promise.set_value(pg); } void PGMap::pg_loaded(spg_t pgid, Ref pg)