]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix `dump dir` indicate dir is not cached 55986/head
authorJos Collin <jcollin@redhat.com>
Mon, 9 Oct 2023 23:34:01 +0000 (05:04 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 6 Mar 2024 09:31:35 +0000 (15:01 +0530)
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 <jcollin@redhat.com>
(cherry picked from commit 5fb2f98cbc1f4797f5d1c15bc8cd6d2b5ce35ecd)

src/mds/MDSRank.cc

index f28b1ff4b3ececaa04aff9f5419a82368211f961..86e4d29186c45c291716d01d3cdae4085376f10e 100644 (file)
@@ -3371,8 +3371,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();
 }