]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/cephfs/JournalTool.cc
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / tools / cephfs / JournalTool.cc
index 29dca56df00c24cc69f00beea8ef1b72f25267c7..3a3816c7a8e9bb916181d929f340b01d5a397488 100644 (file)
@@ -48,8 +48,8 @@ void JournalTool::usage()
     << "      import <path> [--force]\n"
     << "      export <path>\n"
     << "      reset [--force]\n"
-    << "  cephfs-journal-tool [options] header <get|set <field> <value>\n"
-    << "    <field>: [trimmed_pos|expire_pos|write_pos|pool_id]"
+    << "  cephfs-journal-tool [options] header <get|set> <field> <value>\n"
+    << "    <field>: [trimmed_pos|expire_pos|write_pos|pool_id]\n"
     << "  cephfs-journal-tool [options] event <effect> <selector> <output> [special options]\n"
     << "    <selector>:\n"
     << "      --range=<start>..<end>\n"
@@ -65,7 +65,7 @@ void JournalTool::usage()
     << "  --rank=filesystem:mds-rank|all Journal rank (mandatory)\n"
     << "  --journal=<mdlog|purge_queue>  Journal type (purge_queue means\n"
     << "                                 this journal is used to queue for purge operation,\n"
-    << "                                 default is mdlog, and only mdlog support event mode)\n" 
+    << "                                 default is mdlog, and only mdlog support event mode)\n"
     << "\n"
     << "Special options\n"
     << "  --alternate-pool <name>     Alternative metadata pool to target\n"
@@ -224,6 +224,11 @@ bool JournalTool::can_execute_for_all_ranks(const std::string &mode,
  */
 int JournalTool::main_journal(std::vector<const char*> &argv)
 {
+  if (argv.empty()) {
+    derr << "Missing journal command, please see help" << dendl;
+    return -EINVAL;
+  }
+
   std::string command = argv[0];
   if (command == "inspect") {
     return journal_inspect();
@@ -291,8 +296,8 @@ int JournalTool::main_header(std::vector<const char*> &argv)
     ceph_assert(js.header != NULL);
   }
 
-  if (argv.size() == 0) {
-    derr << "Invalid header command, must be [get|set]" << dendl;
+  if (argv.empty()) {
+    derr << "Missing header command, must be [get|set]" << dendl;
     return -EINVAL;
   }
   std::vector<const char *>::iterator arg = argv.begin();
@@ -367,8 +372,12 @@ int JournalTool::main_event(std::vector<const char*> &argv)
 {
   int r;
 
-  std::vector<const char*>::iterator arg = argv.begin();
+  if (argv.empty()) {
+    derr << "Missing event command, please see help" << dendl;
+    return -EINVAL;
+  }
 
+  std::vector<const char*>::iterator arg = argv.begin();
   std::string command = *(arg++);
   if (command != "get" && command != "splice" && command != "recover_dentries") {
     derr << "Unknown argument '" << command << "'" << dendl;