]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: resolve SIGSEGV in waiting for uncommitted fragments
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 30 Jul 2020 02:36:28 +0000 (19:36 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 30 Jul 2020 15:59:01 +0000 (08:59 -0700)
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>
src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/MDSRank.cc

index f5660b1e99d3201cfb4cb4186cfdbd1ecf4e65fa..331d85102aaca6c6be5415dfa93448aa19470a9e 100644 (file)
@@ -12311,10 +12311,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();
 }
 
 struct C_MDC_FragmentRollback : public MDCacheLogContext {
index 13764f054b005d11018558dd1988f6890791229d..1829350f8e1d8a019b1a9673c3efdd423e69066e 100644 (file)
@@ -881,7 +881,7 @@ class MDCache {
   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 3f49d186243a01de85ec583214b83e8163a8904e..857361d71f64354b12e369fe9e8d9bd1b0d399db 100644 (file)
@@ -1959,9 +1959,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;
   }