From: Jos Collin Date: Mon, 9 Oct 2023 23:34:01 +0000 (+0530) Subject: mds: fix `dump dir` indicate dir is not cached X-Git-Tag: v19.1.0~213^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=382e2cd189b5d13d8e20bc7acdad8f30d6a2bed1;p=ceph.git mds: fix `dump dir` indicate dir is not cached Example output: $ ceph daemon mds.a dump dir /test-dir [ { "value/bits": "0/0", "status": "dirfrag not in cache" } ] Fixes: https://tracker.ceph.com/issues/63093 Signed-off-by: Jos Collin (cherry picked from commit 5fb2f98cbc1f4797f5d1c15bc8cd6d2b5ce35ecd) --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 6f8439470a655..b58fe13f98d92 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -3388,8 +3388,14 @@ void MDSRank::command_dump_dir(Formatter *f, const cmdmap_t &cmdmap, std::ostrea in->dirfragtree.get_leaves_under(frag_t(), leaves); for (const auto& leaf : leaves) { CDir *dir = in->get_dirfrag(leaf); - if (dir) + if (dir) { mdcache->dump_dir(f, dir, dentry_dump); + } else { + f->open_object_section("frag"); + f->dump_stream("frag") << leaf; + f->dump_string("status", "dirfrag not in cache"); + f->close_section(); + } } f->close_section(); }