From f9e58687612d60a416dd32c321069060244ce07e Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 29 Jul 2020 19:36:28 -0700 Subject: [PATCH] mds: resolve SIGSEGV in waiting for uncommitted fragments The MDSGatherBuilder was not correctly used / wired up. Fixes: https://tracker.ceph.com/issues/46765 Fixes: 77eb368d2d35f2418875227fff9a34b5ef15a290 Signed-off-by: Patrick Donnelly --- src/mds/MDCache.cc | 9 ++++++--- src/mds/MDCache.h | 2 +- src/mds/MDSRank.cc | 4 +--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index f5660b1e99d32..331d85102aaca 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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 { diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 13764f054b005..1829350f8e1d8 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -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); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 3f49d186243a0..857361d71f643 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -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; } -- 2.39.5