]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: Wait for MDCache to be ready before starting log segment
authorDouglas Fuller <dfuller@redhat.com>
Mon, 31 Jul 2017 13:33:42 +0000 (09:33 -0400)
committerDouglas Fuller <dfuller@redhat.com>
Mon, 31 Jul 2017 14:51:24 +0000 (10:51 -0400)
These can race as the MDS starts.

Fixes: http://tracker.ceph.com/issues/20799
Signed-off-by: Douglas Fuller <dfuller@redhat.com>
src/mds/MDSRank.cc

index d2501bbb56f44057fbd5fdbe74d2b200a0e5f928..879568277744462b5865c38c01bde4600baafb7a 100644 (file)
@@ -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();
+                          })));
+  }
 }