]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: resolve SIGSEGV in waiting for uncommitted fragments 36968/head
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 30 Jul 2020 02:36:28 +0000 (19:36 -0700)
committerVicente Cheng <freeze.bilsted@gmail.com>
Thu, 3 Sep 2020 07:48:19 +0000 (07:48 +0000)
The MDSGatherBuilder was not correctly used / wired up.

Fixes: https://tracker.ceph.com/issues/46765
Fixes: 77eb368d2d35f2418875227fff9a34b5ef15a290
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit f9e58687612d60a416dd32c321069060244ce07e)

src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/MDSRank.cc

index f771ca5455622df2c5b8077c8c731b09d5097838..70aacf5d33fd6b60652317e43980b098ab333228 100644 (file)
@@ -11985,10 +11985,13 @@ void MDCache::rollback_uncommitted_fragment(dirfrag_t basedirfrag, frag_vec_t&&
   }
 }
 
-void MDCache::wait_for_uncommitted_fragments(MDSGather *gather)
+void MDCache::wait_for_uncommitted_fragments(MDSContext* finisher)
 {
-  for (auto& p : uncommitted_fragments)
-    p.second.waiters.push_back(gather->new_sub());
+  MDSGatherBuilder gather(g_ceph_context, finisher);
+  for (auto& p : uncommitted_fragments) {
+    p.second.waiters.push_back(gather.new_sub());
+  }
+  gather.activate();
 }
 
 void MDCache::rollback_uncommitted_fragments()
index 40d449fa685d4ce09e7fd1c2f2e3601f175e9a9a..ab5adb68d58e1f91f2c482eb3a0ad818d39b11d0 100644 (file)
@@ -1254,7 +1254,7 @@ public:
   bool is_any_uncommitted_fragment() const {
     return !uncommitted_fragments.empty();
   }
-  void wait_for_uncommitted_fragments(MDSGather *gather);
+  void wait_for_uncommitted_fragments(MDSContext* finisher);
   void rollback_uncommitted_fragments();
 
   void split_dir(CDir *dir, int byn);
index 9ddd1246af0438352df24e2cc18530421068148d..4997daacba9a7a8e8448b2163f6b48ae3b2b2ab2 100644 (file)
@@ -1918,9 +1918,7 @@ void MDSRank::rejoin_done()
 
   if (mdcache->is_any_uncommitted_fragment()) {
     dout(1) << " waiting for uncommitted fragments" << dendl;
-    MDSGatherBuilder gather(g_ceph_context, new C_MDS_VoidFn(this, &MDSRank::rejoin_done));
-    mdcache->wait_for_uncommitted_fragments(gather.get());
-    gather.activate();
+    mdcache->wait_for_uncommitted_fragments(new C_MDS_VoidFn(this, &MDSRank::rejoin_done));
     return;
   }