@@ -1147,11 +1147,11 @@ seastar::future<> OSD::_handle_osd_map(Ref<MOSDMap> m)
11471147 INFO (" {}" , *m);
11481148 if (m->fsid != superblock.cluster_fsid ) {
11491149 WARN (" fsid mismatched" );
1150- return seastar::now () ;
1150+ co_return ;
11511151 }
11521152 if (pg_shard_manager.is_initializing ()) {
11531153 WARN (" i am still initializing" );
1154- return seastar::now () ;
1154+ co_return ;
11551155 }
11561156
11571157 const auto first = m->get_first ();
@@ -1172,59 +1172,53 @@ seastar::future<> OSD::_handle_osd_map(Ref<MOSDMap> m)
11721172 // make sure there is something new, here, before we bother flushing
11731173 // the queues and such
11741174 if (last <= superblock.get_newest_map ()) {
1175- return seastar::now () ;
1175+ co_return ;
11761176 }
11771177 // missing some?
11781178 epoch_t start = superblock.get_newest_map () + 1 ;
11791179 if (first > start) {
11801180 INFO (" message skips epochs {}..{}" ,
11811181 start, first - 1 );
11821182 if (m->cluster_osdmap_trim_lower_bound <= start) {
1183- return get_shard_services ().osdmap_subscribe (start, false );
1183+ co_return co_await get_shard_services ().osdmap_subscribe (start, false );
11841184 }
11851185 // always try to get the full range of maps--as many as we can. this
11861186 // 1- is good to have
11871187 // 2- is at present the only way to ensure that we get a *full* map as
11881188 // the first map!
11891189 if (m->cluster_osdmap_trim_lower_bound < first) {
1190- return get_shard_services ().osdmap_subscribe (
1190+ co_return co_await get_shard_services ().osdmap_subscribe (
11911191 m->cluster_osdmap_trim_lower_bound - 1 , true );
11921192 }
11931193 }
11941194
1195- return seastar::do_with (ceph::os::Transaction{},
1196- [=, this ](auto & t) {
1197- return pg_shard_manager.store_maps (t, start, m).then ([=, this , &t] {
1198- // even if this map isn't from a mon, we may have satisfied our subscription
1199- monc->sub_got (" osdmap" , last);
1195+ ceph::os::Transaction t;
1196+ co_await pg_shard_manager.store_maps (t, start, m);
12001197
1201- if (!superblock.is_maps_empty ()) {
1202- pg_shard_manager.trim_maps (t, superblock);
1203- // TODO: once we support pg splitting, update pg_num_history here
1204- // pg_num_history.prune(superblock.get_oldest_map());
1205- }
1198+ // even if this map isn't from a mon, we may have satisfied our subscription
1199+ monc->sub_got (" osdmap" , last);
1200+
1201+ if (!superblock.is_maps_empty ()) {
1202+ pg_shard_manager.trim_maps (t, superblock);
1203+ }
12061204
1207- superblock.insert_osdmap_epochs (first, last);
1208- superblock.current_epoch = last;
1205+ superblock.insert_osdmap_epochs (first, last);
1206+ superblock.current_epoch = last;
12091207
1210- // note in the superblock that we were clean thru the prior epoch
1211- if (boot_epoch && boot_epoch >= superblock.mounted ) {
1212- superblock.mounted = boot_epoch;
1213- superblock.clean_thru = last;
1214- }
1215- pg_shard_manager.get_meta_coll ().store_superblock (t, superblock);
1216- return pg_shard_manager.set_superblock (superblock).then (
1217- [FNAME, this , &t] {
1218- DEBUG (" submitting transaction" );
1219- return store.get_sharded_store ().do_transaction (
1220- pg_shard_manager.get_meta_coll ().collection (),
1221- std::move (t));
1222- });
1223- });
1224- }).then ([=, this ] {
1225- // TODO: write to superblock and commit the transaction
1226- return committed_osd_maps (start, last, m);
1227- });
1208+ // note in the superblock that we were clean thru the prior epoch
1209+ if (boot_epoch && boot_epoch >= superblock.mounted ) {
1210+ superblock.mounted = boot_epoch;
1211+ superblock.clean_thru = last;
1212+ }
1213+ pg_shard_manager.get_meta_coll ().store_superblock (t, superblock);
1214+ co_await pg_shard_manager.set_superblock (superblock);
1215+
1216+ DEBUG (" submitting transaction" );
1217+ co_await store.get_sharded_store ().do_transaction (
1218+ pg_shard_manager.get_meta_coll ().collection (), std::move (t));
1219+
1220+ // TODO: write to superblock and commit the transaction
1221+ co_await committed_osd_maps (start, last, m);
12281222}
12291223
12301224seastar::future<> OSD::committed_osd_maps (
0 commit comments