From bffa375975ec0d1b2dbc01775a8a71e0357e2703 Mon Sep 17 00:00:00 2001 From: Douglas Fuller Date: Mon, 31 Jul 2017 09:33:42 -0400 Subject: [PATCH] cephfs: Wait for MDCache to be ready before starting log segment These can race as the MDS starts. Fixes: http://tracker.ceph.com/issues/20799 Signed-off-by: Douglas Fuller --- src/mds/MDSRank.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index d2501bbb56f..87956827774 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1144,8 +1144,14 @@ void MDSRank::starting_done() mdcache->open_root(); - // start new segment - mdlog->start_new_segment(); + if (mdcache->is_open()) { + mdlog->start_new_segment(); + } else { + mdcache->wait_for_open(new MDSInternalContextWrapper(this, + new FunctionContext([this] (int r) { + mdlog->start_new_segment(); + }))); + } } -- 2.47.3