mirror of
https://github.com/ceph/ceph
synced 2025-02-24 03:27:10 +00:00
Merge pull request #42475 from tchaikov/wip-crimson-cleanup
crimson/osd: cleanups Reviewed-by: Chunmei Liu <chunmei.liu@intel.com>
This commit is contained in:
commit
d7862cb607
@ -225,30 +225,29 @@ seastar::future<> AdminSocket::start(const std::string& path)
|
||||
return seastar::make_ready_future<>();
|
||||
}
|
||||
// listen in background
|
||||
task = seastar::do_until(
|
||||
[this] { return stop_gate.is_closed(); },
|
||||
[this] {
|
||||
return seastar::with_gate(stop_gate, [this] {
|
||||
assert(!connected_sock.has_value());
|
||||
return server_sock->accept().then([this](seastar::accept_result acc) {
|
||||
connected_sock = std::move(acc.connection);
|
||||
return seastar::do_with(connected_sock->input(),
|
||||
connected_sock->output(),
|
||||
[this](auto& input, auto& output) mutable {
|
||||
return handle_client(input, output);
|
||||
}).finally([this] {
|
||||
assert(connected_sock.has_value());
|
||||
connected_sock.reset();
|
||||
});
|
||||
}).handle_exception([this](auto ep) {
|
||||
if (!stop_gate.is_closed()) {
|
||||
logger().error("AdminSocket: terminated: {}", ep);
|
||||
}
|
||||
task = seastar::keep_doing([this] {
|
||||
return seastar::try_with_gate(stop_gate, [this] {
|
||||
assert(!connected_sock.has_value());
|
||||
return server_sock->accept().then([this](seastar::accept_result acc) {
|
||||
connected_sock = std::move(acc.connection);
|
||||
return seastar::do_with(connected_sock->input(),
|
||||
connected_sock->output(),
|
||||
[this](auto& input, auto& output) mutable {
|
||||
return handle_client(input, output);
|
||||
}).finally([this] {
|
||||
assert(connected_sock.has_value());
|
||||
connected_sock.reset();
|
||||
});
|
||||
}).handle_exception([this](auto ep) {
|
||||
if (!stop_gate.is_closed()) {
|
||||
logger().error("AdminSocket: terminated: {}", ep);
|
||||
}
|
||||
});
|
||||
}).finally([path] {
|
||||
return seastar::remove_file(path);
|
||||
});
|
||||
}).handle_exception_type([](const seastar::gate_closed_exception&) {
|
||||
}).finally([path] {
|
||||
return seastar::remove_file(path);
|
||||
});
|
||||
return seastar::make_ready_future<>();
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,10 @@ add_executable(crimson-osd
|
||||
${PROJECT_SOURCE_DIR}/src/osd/osd_perf_counters.cc
|
||||
watch.cc
|
||||
)
|
||||
if(HAS_VTA)
|
||||
set_source_files_properties(main.cc
|
||||
PROPERTIES COMPILE_FLAGS -fno-var-tracking-assignments)
|
||||
endif()
|
||||
target_link_libraries(crimson-osd
|
||||
crimson-admin
|
||||
crimson-common
|
||||
|
@ -31,6 +31,10 @@
|
||||
namespace bpo = boost::program_options;
|
||||
using config_t = crimson::common::ConfigProxy;
|
||||
|
||||
seastar::logger& logger() {
|
||||
return crimson::get_logger(ceph_subsys_osd);
|
||||
}
|
||||
|
||||
void usage(const char* prog) {
|
||||
std::cout << "usage: " << prog << " -i <ID>\n"
|
||||
<< " --help-seastar show Seastar help messages\n";
|
||||
@ -315,15 +319,15 @@ int main(int argc, char* argv[])
|
||||
} else {
|
||||
osd.invoke_on(0, &crimson::osd::OSD::start).get();
|
||||
}
|
||||
seastar::fprint(std::cout, "crimson startup completed.");
|
||||
logger().info("crimson startup completed");
|
||||
should_stop.wait().get();
|
||||
seastar::fprint(std::cout, "crimson shutting down.");
|
||||
logger().info("crimson shutting down");
|
||||
// stop()s registered using defer() are called here
|
||||
} catch (...) {
|
||||
seastar::fprint(std::cerr, "FATAL: startup failed: %s\n", std::current_exception());
|
||||
logger().error("startup failed: {}", std::current_exception());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
seastar::fprint(std::cout, "crimson shutdown complete");
|
||||
logger().info("crimson shutdown complete");
|
||||
return EXIT_SUCCESS;
|
||||
});
|
||||
});
|
||||
|
@ -476,6 +476,8 @@ seastar::future<> OSD::start_asok_admin()
|
||||
seastar::future<> OSD::stop()
|
||||
{
|
||||
logger().info("stop");
|
||||
beacon_timer.cancel();
|
||||
tick_timer.cancel();
|
||||
// see also OSD::shutdown()
|
||||
return prepare_to_stop().then([this] {
|
||||
state.set_stopping();
|
||||
|
@ -1148,6 +1148,8 @@ seastar::future<> PG::stop()
|
||||
{
|
||||
logger().info("PG {} {}", pgid, __func__);
|
||||
stopping = true;
|
||||
check_readable_timer.cancel();
|
||||
renew_lease_timer.cancel();
|
||||
return osdmap_gate.stop().then([this] {
|
||||
return wait_for_active_blocker.stop();
|
||||
}).then([this] {
|
||||
|
Loading…
Reference in New Issue
Block a user