]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: dispatch quiesce_inode ops after dir traversal
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 7 Mar 2024 19:30:35 +0000 (14:30 -0500)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 22 Mar 2024 15:38:03 +0000 (11:38 -0400)
Mostly to avoid the possibility of the CDir::items changing during iteration
when calling sub-ops.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit c90cc2d04bb2d6d4e558fe268bcd241ea7723880)

src/mds/MDCache.cc

index e21d2d4d0ecda8c4657690fa6992d979fb071fb2..83fffabd509903cfd2a2140cbd2a6d760c654ca8 100644 (file)
@@ -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<MDRequestRef> 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();