From 37b83f4ed7ca69f105b93bf482cb2289cbaf9a4d Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 29 May 2021 15:03:01 +0800 Subject: [PATCH] crimson/osd/main: do cleanup using defer() since we do the startup in a seastar thread, we have the luxury of doing cleanup using the RAII machinery. Signed-off-by: Kefu Chai --- src/crimson/osd/main.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 0152e6ce6e58b..c8e0e5a6b5727 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -214,12 +214,12 @@ int main(int argc, char* argv[]) ); } sharded_conf().start(init_params.name, cluster_name).get(); - seastar::engine().at_exit([] { - return sharded_conf().stop(); + auto stop_conf = seastar::defer([] { + sharded_conf().stop().get(); }); sharded_perf_coll().start().get(); - seastar::engine().at_exit([] { - return sharded_perf_coll().stop(); + auto stop_perf_coll = seastar::defer([] { + sharded_perf_coll().stop().get(); }); local_conf().parse_config_files(conf_file_list).get(); local_conf().parse_argv(ceph_args).get(); @@ -263,8 +263,8 @@ int main(int argc, char* argv[]) local_conf().get_val("osd_uuid"), local_conf().get_val("fsid")).get(); } - seastar::engine().at_exit([&] { - return osd.stop(); + auto stop_osd = seastar::defer([&] { + osd.stop().get(); }); if (config.count("mkkey") || config.count("mkfs")) { return EXIT_SUCCESS; -- 2.39.5