]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix rank 0 marked damaged if stopping fails after Elid flush and log trimmed 65778/head
authorethanwu <ethanwu@synology.com>
Thu, 11 Sep 2025 07:40:09 +0000 (15:40 +0800)
committerJos Collin <jcollin@redhat.com>
Sat, 4 Oct 2025 01:53:38 +0000 (07:23 +0530)
steps to reproduce
 ../src/vstart.sh --debug --new -x --localhost --bluestore
 ./bin/ceph tell mds.<rank 0> config set mds_kill_shutdown_at 10
 ./bin/ceph fs set <fs name> down true

wait for a few seconds and will see the following log from take-over mds
and rank 0 is marked damaged
2025-09-11T16:47:24.591+0800 785dabeaa6c0 -1 log_channel(cluster) log [ERR] : No subtrees found for root MDS rank!
2025-09-11T16:47:24.591+0800 785dabeaa6c0 5 mds.beacon.b set_want_state: up:rejoin -> down:damaged

During shutdown_pass after submitting Elid and trimming mdlog, mds log
will now have only ELid event which does nothing at replay.
After replay, no subtree is found.

Fix this by checking whther MDLog contains only one event.
If so, skip the subtree check for rank 0, and allow it to request
STATE_STOPPED just like the other ranks.

Fixes: https://tracker.ceph.com/issues/72983
Signed-off-by: ethanwu <ethanwu@synology.com>
(cherry picked from commit adb448b4f4e421f75275874f5a67c3a2ceb0214c)

src/mds/MDSRank.cc

index 59f695a8c0422b3416c4206f3d7ffa87b314ca2c..a40156ad721a3bc8e59fe8432af1c4dd72336e51 100644 (file)
@@ -2031,8 +2031,9 @@ void MDSRank::rejoin_done()
 
   // funny case: is our cache empty?  no subtrees?
   if (!mdcache->is_subtrees()) {
-    if (whoami == 0) {
-      // The root should always have a subtree!
+    if (whoami == 0 && mdlog->get_num_events() > 1) {
+      // The root should always have a subtree except when
+      // the mdlog contains only the ELid event
       clog->error() << "No subtrees found for root MDS rank!";
       damaged();
       ceph_assert(mdcache->is_subtrees());