]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg_map: fix pg_creating removal order
authorSamuel Just <sjust@redhat.com>
Sat, 1 Oct 2022 20:01:36 +0000 (13:01 -0700)
committerSamuel Just <sjust@redhat.com>
Sat, 1 Oct 2022 22:00:32 +0000 (15:00 -0700)
Simpler to fulfill the promise only after restoring the
pg_creating/pgs invariant.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/pg_map.cc

index d291419dd37d5e90777a73dbba69f2826f5473a9..8a6e5995daf2c8676dc4bdb9865dcb5d73352e22 100644 (file)
@@ -64,10 +64,11 @@ void PGMap::pg_created(spg_t pgid, Ref<PG> 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> pg)