From a069e7a6ac84424a92d059e1b1f6edb4efb36265 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Fri, 21 Feb 2025 19:18:57 +0530 Subject: [PATCH] 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 --- src/mds/MDCache.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e2a83fcc6bfda..5df3dba152c0c 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) { -- 2.39.5