From: Xiubo Li Date: Fri, 24 Dec 2021 04:50:23 +0000 (+0800) Subject: mds: dump tree '/' when the path is empty X-Git-Tag: v16.2.8~236^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c12ba5764f55242e36e4b1049bede7c12d529f43;p=ceph.git mds: dump tree '/' when the path is empty 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 (cherry picked from commit cc80cea0db697ceec7a8c4d5dacc4840e661834e) --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index d850c1741ac3c..edc3052c362d7 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -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);