From 172c15c1548aadc9ae744e55810ea21f00de6bd7 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 24 Aug 2021 14:02:36 +0000 Subject: [PATCH] crimson/osd: implicitly append '--smp 1' when invoked without it This commit is basically a hack supposed to fulfil the obligation of crimson being a drop-in replacement for the classical OSD we already made by packaging it under `/usr/bin/ceph-osd`. The discussion whether the interface-exactness should be continued or not is out of scope of the commit; it's supposed just to handle the issue unveiled by the Rook integration effort: `crimson-osd` is unable to `--mkfs` because Seastar, if not restricted by passing `--smp N`, considers all CPU cores available in the system when allocating resources. This leads to the following error: ``` ERROR 2021-08-24 14:17:32,105 [shard 5] seastar - Could not setup Async I/O: Resource temporarily unavailable. The most common cause is not enough request capacity in /proc/sys/fs/aio-max-nr. Try increasing that number or reducing the amount of logical CPUs available for your application ``` This hack will need to be dropped when integrating multi-reactor support in crimson. Signed-off-by: Radoslaw Zarzynski --- src/crimson/osd/main.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 169c2f4540b09..2a2ef3f0ccd0b 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -183,6 +183,20 @@ seastar::future<> fetch_config() }); } +static void override_seastar_opts(std::vector& args) +{ + if (auto found = std::find_if(std::begin(args), std::end(args), + [] (auto* arg) { return "--smp"sv == arg; }); + found == std::end(args)) { + // TODO: we don't have a way to communicate the resource requirements + // with the deployment tools, like cephadm and rook, which don't set, for + // instance, aio-max-nr for us. but we should fix this, once crimson is able + // to run on a multi-core system, i.e., once m-to-n problem is resolved. + args.emplace_back("--smp"); + args.emplace_back("1"); + } +} + int main(int argc, char* argv[]) { seastar::app_template::config app_cfg; @@ -208,6 +222,7 @@ int main(int argc, char* argv[]) usage(argv[0]); return EXIT_SUCCESS; } + override_seastar_opts(app_args); std::string cluster_name{"ceph"}; std::string conf_file_list; // ceph_argparse_early_args() could _exit(), while local_conf() won't ready -- 2.39.5