From: Patrick Donnelly Date: Thu, 30 Jul 2020 02:36:28 +0000 (-0700) Subject: mds: resolve SIGSEGV in waiting for uncommitted fragments X-Git-Tag: v14.2.12~23^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=993528a0d7a53422ef6643830dfc03aedbaaffa7;p=ceph.git 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 (cherry picked from commit f9e58687612d60a416dd32c321069060244ce07e) --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index f771ca545562..70aacf5d33fd 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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() diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 40d449fa685d..ab5adb68d58e 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -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); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 9ddd1246af04..4997daacba9a 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -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; }