]> git.apps.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>
Tue, 18 Jan 2022 01:51:50 +0000 (09:51 +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>
(cherry picked from commit cc80cea0db697ceec7a8c4d5dacc4840e661834e)

src/mds/MDSRank.cc

index d850c1741ac3c568f0e022ffd5581a9244e3e5ad..edc3052c362d703e66284b996a7fe103220a99ff 100644 (file)
@@ -3095,6 +3095,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);