From: Kotresh HR Date: Fri, 21 Feb 2025 13:48:57 +0000 (+0530) Subject: mds/rejoin: Don't fetch the dir is already complete during rejoin X-Git-Tag: v20.3.0~377^2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a069e7a6ac84424a92d059e1b1f6edb4efb36265;p=ceph.git mds/rejoin: Don't fetch the dir is already complete during rejoin 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 --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e2a83fcc6bfd..5df3dba152c0 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6051,14 +6051,18 @@ bool MDCache::open_undef_inodes_dirfrags() map > > 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("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) {