//TODO(): fsck and reuse existing cache objects
if (reset) {
+ std::error_code ec;
if (efs::exists(m_cache_root_dir)) {
- efs::remove_all(m_cache_root_dir);
+ if (!efs::remove_all(m_cache_root_dir, ec)) {
+ lderr(m_cct) << "fail to remove old cache store: " << ec << dendl;
+ return -1;
+ }
+ }
+
+ if (!efs::create_directories(m_cache_root_dir, ec)) {
+ lderr(m_cct) << "fail to create cache store dir: " << ec << dendl;
+ return -1;
}
- efs::create_directories(m_cache_root_dir);
}
return ret;
env_to_vec(args);
argv_to_vec(argc, argv, args);
+ if (ceph_argparse_need_usage(args)) {
+ usage();
+ exit(0);
+ }
+
auto cct = global_init(nullptr, args, CEPH_ENTITY_TYPE_CLIENT,
CODE_ENVIRONMENT_DAEMON,
CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
- for (auto i = args.begin(); i != args.end(); ++i) {
- if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
- usage();
- return EXIT_SUCCESS;
- }
- }
-
if (g_conf()->daemonize) {
global_init_daemonize(g_ceph_context);
}