]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/rejoin: Don't fetch the dir is already complete during rejoin
authorKotresh HR <khiremat@redhat.com>
Fri, 21 Feb 2025 13:48:57 +0000 (19:18 +0530)
committerKotresh HR <khiremat@redhat.com>
Tue, 4 Mar 2025 06:20:47 +0000 (11:50 +0530)
In MDCache::open_undef_inodes_dirfrags, it can so happen that
the same dir is added twice to fetch queue causing it to fetch
twice and hit the assert that dir is not complete for the
second fetch. So don't fetch if the dir is complete.

Fixes: https://tracker.ceph.com/issues/54205
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/mds/MDCache.cc

index e2a83fcc6bfda7fc24bde2a6a3c11a074b0d07f7..5df3dba152c0cba54c072e469225e41c42c884d2 100644 (file)
@@ -6051,14 +6051,18 @@ bool MDCache::open_undef_inodes_dirfrags()
   map<CDir*, pair<bool, std::vector<dentry_key_t> > > fetch_queue;
   for (auto& dir : rejoin_undef_dirfrags) {
     ceph_assert(dir->get_version() == 0);
-    fetch_queue.emplace(std::piecewise_construct, std::make_tuple(dir), std::make_tuple());
+    // No need to fetch if the dir is already complete
+    if (!dir->is_complete())
+      fetch_queue.emplace(std::piecewise_construct, std::make_tuple(dir), std::make_tuple());
   }
 
   if (g_conf().get_val<bool>("mds_dir_prefetch")) {
     for (auto& in : rejoin_undef_inodes) {
       ceph_assert(!in->is_base());
       ceph_assert(in->get_parent_dir());
-      fetch_queue.emplace(std::piecewise_construct, std::make_tuple(in->get_parent_dir()), std::make_tuple());
+      // No need to fetch if the dir is already complete
+      if (!in->get_parent_dir()->is_complete())
+        fetch_queue.emplace(std::piecewise_construct, std::make_tuple(in->get_parent_dir()), std::make_tuple());
     }
   } else {
     for (auto& in : rejoin_undef_inodes) {