]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/ceph_fuse.cc
import quincy 17.2.0
[ceph.git] / ceph / src / ceph_fuse.cc
index b707806b6699ec267800cb0b6ac469dc569681a5..115856f381cfd9cbfcd0bf7d8cee99b44677fce9 100644 (file)
@@ -16,7 +16,9 @@
 #include <sys/utsname.h>
 #include <iostream>
 #include <string>
+#include <optional>
 
+#include "common/async/context_pool.h"
 #include "common/config.h"
 #include "common/errno.h"
 
 
 #define dout_context g_ceph_context
 
+using namespace std;
+
+ceph::async::io_context_pool icp;
+
 static void fuse_usage()
 {
   const char* argv[] = {
@@ -54,7 +60,15 @@ static void fuse_usage()
   struct fuse_args args = FUSE_ARGS_INIT(2, (char**)argv);
 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
   struct fuse_cmdline_opts opts = {};
-  if (fuse_parse_cmdline(&args, &opts) == -1) {
+  if (fuse_parse_cmdline(&args, &opts) != -1) {
+    if (opts.show_help) {
+      cout << "usage: " << argv[0] << " [options] <mountpoint>\n\n";
+      cout << "FUSE options:\n";
+      fuse_cmdline_help();
+      fuse_lowlevel_help();
+      cout << "\n";
+    }
+  } else {
 #else
   if (fuse_parse_cmdline(&args, nullptr, nullptr, nullptr) == -1) {
 #endif
@@ -78,8 +92,7 @@ void usage()
 int main(int argc, const char **argv, const char *envp[]) {
   int filer_flags = 0;
   //cerr << "ceph-fuse starting " << myrank << "/" << world << std::endl;
-  std::vector<const char*> args;
-  argv_to_vec(argc, argv, args);
+  auto args = argv_to_vec(argc, argv);
   if (args.empty()) {
     cerr << argv[0] << ": -h or --help for usage" << std::endl;
     exit(1);
@@ -167,9 +180,8 @@ int main(int argc, const char **argv, const char *envp[]) {
   }
 
   {
-    g_ceph_context->_conf.finalize_reexpand_meta();
     common_init_finish(g_ceph_context);
-   
+
     init_async_signal_handler();
     register_async_signal_handler(SIGHUP, sighup_handler);
 
@@ -192,7 +204,9 @@ int main(int argc, const char **argv, const char *envp[]) {
           "client_try_dentry_invalidate");
        bool can_invalidate_dentries =
           client_try_dentry_invalidate && ver < KERNEL_VERSION(3, 18, 0);
-       int tr = client->test_dentry_handling(can_invalidate_dentries);
+       auto test_result = client->test_dentry_handling(can_invalidate_dentries);
+       int tr = test_result.first;
+       bool abort_on_failure = test_result.second;
         bool client_die_on_failed_dentry_invalidate = g_conf().get_val<bool>(
           "client_die_on_failed_dentry_invalidate");
        if (tr != 0 && client_die_on_failed_dentry_invalidate) {
@@ -218,6 +232,9 @@ int main(int argc, const char **argv, const char *envp[]) {
            }
          }
        }
+       if(abort_on_failure) {
+         ceph_abort();
+       }
        return reinterpret_cast<void*>(tr);
 #else
        return reinterpret_cast<void*>(0);
@@ -234,7 +251,8 @@ int main(int argc, const char **argv, const char *envp[]) {
     int tester_r = 0;
     void *tester_rp = nullptr;
 
-    MonClient *mc = new MonClient(g_ceph_context);
+    icp.start(cct->_conf.get_val<std::uint64_t>("client_asio_thread_count"));
+    MonClient *mc = new MonClient(g_ceph_context, icp);
     int r = mc->build_initial_monmap();
     if (r == -EINVAL) {
       cerr << "failed to generate initial mon list" << std::endl;
@@ -249,7 +267,7 @@ int main(int argc, const char **argv, const char *envp[]) {
     messenger->set_policy(entity_name_t::TYPE_MDS,
                          Messenger::Policy::lossless_client(0));
 
-    client = new StandaloneClient(messenger, mc);
+    client = new StandaloneClient(messenger, mc, icp);
     if (filer_flags) {
       client->set_filer_flags(filer_flags);
     }
@@ -316,6 +334,7 @@ int main(int argc, const char **argv, const char *envp[]) {
     client->unmount();
     cfuse->finalize();
   out_shutdown:
+    icp.stop();
     client->shutdown();
   out_init_failed:
     unregister_async_signal_handler(SIGHUP, sighup_handler);