From 85d89700e21bcdc105916a2a8bca1a4445512eec Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Tue, 19 Mar 2019 21:03:10 +0800 Subject: [PATCH] mds: open import bounding dirfrags in batch Fixes: http://tracker.ceph.com/issues/38679 Signed-off-by: "Yan, Zheng" (cherry picked from commit 1f0dcf2b7f43e93212d56739a9d9d2db771b327f) Conflicts: src/mds/Migrator.cc --- src/mds/Migrator.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 85f6b3b726ebd..47e7b211d3edb 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -2617,6 +2617,7 @@ void Migrator::handle_export_prep(MExportDirPrep *m) if (!finished.empty()) mds->queue_waiters(finished); + MDSGatherBuilder gather(g_ceph_context); bool success = true; if (mds->is_active()) { @@ -2640,9 +2641,8 @@ void Migrator::handle_export_prep(MExportDirPrep *m) CDir *bound = cache->get_dirfrag(dirfrag_t(p->first, *q)); if (!bound) { dout(7) << " opening bounding dirfrag " << *q << " on " << *in << dendl; - cache->open_remote_dirfrag(in, *q, - new C_MDS_RetryMessage(mds, m)); - return; + cache->open_remote_dirfrag(in, *q, gather.new_sub()); + continue; } if (!bound->state_test(CDir::STATE_IMPORTBOUND)) { @@ -2656,6 +2656,12 @@ void Migrator::handle_export_prep(MExportDirPrep *m) } } + if (gather.has_subs()) { + gather.set_finisher(new C_MDS_RetryMessage(mds, m)); + gather.activate(); + return; + } + dout(7) << " all ready, noting auth and freezing import region" << dendl; if (!mds->mdcache->is_readonly() && -- 2.39.5