]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: flush mds log before finishing STATE_STARTING
authorethanwu <ethanwu@synology.com>
Sun, 24 Mar 2024 09:11:16 +0000 (17:11 +0800)
committerethanwu <ethanwu@synology.com>
Mon, 25 Mar 2024 01:32:43 +0000 (09:32 +0800)
If we donn't flush mds log before requesting STATE_ACTIVE, and
mds happens to stop later before the log reaches journal.
The take-over mds will have no SubtreeMap to replay, and fail
later at non-empty subtree check.

Fixes: https://tracker.ceph.com/issues/65094
Signed-off-by: ethanwu <ethanwu@synology.com>
src/mds/MDSRank.cc

index c9e50d79fa209d7e855e930dd5d6c2a6d1ae2392..124e053a64d611d5a7a7969ac1511d225f662f7a 100644 (file)
@@ -1724,7 +1724,10 @@ void MDSRank::boot_start(BootStep step, int r)
       } else {
         dout(2) << "Booting: " << step << ": positioning at end of old mds log" << dendl;
         mdlog->append();
-        starting_done();
+        auto sle = mdcache->create_subtree_map();
+        mdlog->submit_entry(sle);
+        mdlog->flush();
+        mdlog->wait_for_safe(new C_MDS_VoidFn(this, &MDSRank::starting_done));
       }
       break;
     case MDS_BOOT_REPLAY_DONE:
@@ -1771,9 +1774,6 @@ void MDSRank::starting_done()
   ceph_assert(is_starting());
   request_state(MDSMap::STATE_ACTIVE);
 
-  auto sle = mdcache->create_subtree_map();
-  mdlog->submit_entry(sle);
-
   // sync snaptable cache
   snapclient->sync(new C_MDSInternalNoop);
 }