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: testing/wip-root-testing-20240411.174241~89^2~16 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=45c18be188a7caf573d4fe5b1dbb685202eac239;p=ceph-ci.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 (cherry picked from commit c90cc2d04bb2d6d4e558fe268bcd241ea7723880) --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index e21d2d4d0ec..83fffabd509 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();