]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: dump tree '/' when the path is empty
authorXiubo Li <xiubli@redhat.com>
Fri, 24 Dec 2021 04:50:23 +0000 (12:50 +0800)
committerXiubo Li <xiubli@redhat.com>
Wed, 5 Jan 2022 09:08:20 +0000 (17:08 +0800)
The `get subtrees` will return the path '' for the '0x1', and if
we pass '' to the `dump tree ''` command, the MDS will crash.

Fixes: https://tracker.ceph.com/issues/53726
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/mds/MDSRank.cc

index ff6cfc9343be7386b1d6464b292c0452625d94ff..886a379dd7ae9cbe1ea4169e19460787dfdde598 100644 (file)
@@ -3107,6 +3107,9 @@ void MDSRank::command_dump_tree(const cmdmap_t &cmdmap, std::ostream &ss, Format
   std::string root;
   int64_t depth;
   cmd_getval(cmdmap, "root", root);
+  if (root.empty()) {
+    root = "/";
+  }
   if (!cmd_getval(cmdmap, "depth", depth))
     depth = -1;
   std::lock_guard l(mds_lock);