From: Patrick Donnelly Date: Thu, 7 Mar 2024 19:30:35 +0000 (-0500) Subject: mds: dispatch quiesce_inode ops after dir traversal X-Git-Tag: v20.0.0~2328^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c90cc2d04bb2d6d4e558fe268bcd241ea7723880;p=ceph.git mds: dispatch quiesce_inode ops after dir traversal Mostly to avoid the possibility of the CDir::items changing during iteration when calling sub-ops. Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e21d2d4d0ecd..83fffabd5099 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -13645,6 +13645,7 @@ void MDCache::dispatch_quiesce_inode(const MDRequestRef& mdr) } } MDSGatherBuilder gather(g_ceph_context, new C_MDS_RetryRequest(this, mdr)); + std::vector todispatch; for (auto& dir : in->get_dirfrags()) { for (auto& [dnk, dn] : *dir) { auto* in = dn->get_projected_inode(); @@ -13669,13 +13670,16 @@ void MDCache::dispatch_quiesce_inode(const MDRequestRef& mdr) cache->dispatch_request(qimdr); })); } else { - dispatch_request(qimdr); - } - if (!(qs.inc_heartbeat_count() % mds->heartbeat_reset_grace())) { - mds->heartbeat_reset(); + todispatch.push_back(qimdr); } } } + for (auto& qimdr : todispatch) { + dispatch_request(qimdr); + if (!(qs.inc_heartbeat_count() % mds->heartbeat_reset_grace())) { + mds->heartbeat_reset(); + } + } if (gather.has_subs()) { dout(20) << __func__ << ": waiting for sub-ops to gather" << dendl; gather.activate();