Just like STATE_CREATING, mds could fail or being stopped any where at
STATE_STARTING state, so make sure subsequent take-over mds will start
from STATE_STARTING. Otherwise, we'll end up with empty journal(No ESubtreeMap).
The subsequent take-over mds will fail with no subtrees found and rank will be
marked damaged.
Quick way to reproduce this:
./bin/ceph fs set a down true # take down all rank in filesystem a
#wait for fs to stop all rank
./bin/ceph fs set a down true; pidof ceph-mds | xargs kill
# quickly kill all mds soon after they enter starting state
./bin/ceph-mds -i a -c ./ceph.conf
# start all mds. Then we'll find out that mds rank is reported damaged with following log
-1 log_channel(cluster) log [ERR] : No subtrees found for root MDS rank!
5 mds.beacon.a set_want_state: up:rejoin -> down:damaged
Fixes: https://tracker.ceph.com/issues/65094
Signed-off-by: ethanwu <ethanwu@synology.com>
// the rank ever existed so that next time it's handed out
// to a gid it'll go back into CREATING.
fs.mds_map.in.erase(info.rank);
+ } else if (info.state == MDSMap::STATE_STARTING) {
+ // If this gid didn't make it past STARTING, then forget
+ // the rank ever existed so that next time it's handed out
+ // to a gid it'll go back into STARTING.
+ fs.mds_map.in.erase(info.rank);
+ fs.mds_map.stopped.insert(info.rank);
} else {
// Put this rank into the failed list so that the next available
// STANDBY will pick it up.