Skip to content

Commit 9120b86

Browse files
committed
Merge PR ceph#56429 into main
* refs/pull/56429/head: mds: fix rank root doesn't insert root ino into its subtree map when starting mds: flush mds log before finishing STATE_STARTING mds/FSMap: go back to STARTING state when rank doesn't make it pass STARTING Reviewed-by: Venky Shankar <[email protected]> Reviewed-by: Patrick Donnelly <[email protected]>
2 parents 0627148 + 463c3b7 commit 9120b86

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

src/mds/FSMap.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,12 @@ void FSMap::erase(mds_gid_t who, epoch_t blocklist_epoch)
10111011
// the rank ever existed so that next time it's handed out
10121012
// to a gid it'll go back into CREATING.
10131013
fs.mds_map.in.erase(info.rank);
1014+
} else if (info.state == MDSMap::STATE_STARTING) {
1015+
// If this gid didn't make it past STARTING, then forget
1016+
// the rank ever existed so that next time it's handed out
1017+
// to a gid it'll go back into STARTING.
1018+
fs.mds_map.in.erase(info.rank);
1019+
fs.mds_map.stopped.insert(info.rank);
10141020
} else {
10151021
// Put this rank into the failed list so that the next available
10161022
// STANDBY will pick it up.

src/mds/MDCache.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,24 @@ void MDCache::open_root_inode(MDSContext *c)
640640
if (mds->get_nodeid() == mds->mdsmap->get_root()) {
641641
CInode *in;
642642
in = create_system_inode(CEPH_INO_ROOT, S_IFDIR|0755); // initially inaccurate!
643-
in->fetch(c);
643+
if (mds->is_starting()) {
644+
in->fetch(
645+
new MDSInternalContextWrapper(mds,
646+
new LambdaContext([this, c](int r) {
647+
if (r < 0) {
648+
c->complete(r);
649+
return;
650+
}
651+
CDir *rootdir = root->get_or_open_dirfrag(this, frag_t());
652+
ceph_assert(rootdir);
653+
adjust_subtree_auth(rootdir, mds->get_nodeid());
654+
rootdir->fetch(c);
655+
})
656+
)
657+
);
658+
} else {
659+
in->fetch(c);
660+
}
644661
} else {
645662
discover_base_ino(CEPH_INO_ROOT, c, mds->mdsmap->get_root());
646663
}

src/mds/MDSRank.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,10 @@ void MDSRank::boot_start(BootStep step, int r)
17241724
} else {
17251725
dout(2) << "Booting: " << step << ": positioning at end of old mds log" << dendl;
17261726
mdlog->append();
1727-
starting_done();
1727+
auto sle = mdcache->create_subtree_map();
1728+
mdlog->submit_entry(sle);
1729+
mdlog->flush();
1730+
mdlog->wait_for_safe(new C_MDS_VoidFn(this, &MDSRank::starting_done));
17281731
}
17291732
break;
17301733
case MDS_BOOT_REPLAY_DONE:
@@ -1771,9 +1774,6 @@ void MDSRank::starting_done()
17711774
ceph_assert(is_starting());
17721775
request_state(MDSMap::STATE_ACTIVE);
17731776

1774-
auto sle = mdcache->create_subtree_map();
1775-
mdlog->submit_entry(sle);
1776-
17771777
// sync snaptable cache
17781778
snapclient->sync(new C_MDSInternalNoop);
17791779
}

0 commit comments

Comments
 (0)