mds: properly save snaptable after upgrading version

commit 002c732d "mds: make sure snaptable version > 0" is buggy

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
This commit is contained in:
Yan, Zheng 2018-04-11 09:59:04 +08:00
parent b6344f366d
commit 67c0b8ed0e

View File

@ -1317,11 +1317,12 @@ void MDSRank::replay_done()
mdlog->get_journaler()->set_writeable();
mdlog->get_journaler()->trim_tail();
if (snapserver->get_version() == 0) {
if (mdsmap->get_tableserver() == whoami &&
snapserver->get_version() == 0) {
// upgraded from old filesystem. version 0 snaptable confuses current code.
dout(1) << "upgrading snaptable version from 0 to 1" << dendl;
snapserver->reset();
sessionmap.save(new C_MDSInternalNoop);
snapserver->save(new C_MDSInternalNoop);
}
if (g_conf->mds_wipe_sessions) {
@ -1524,7 +1525,6 @@ void MDSRank::boot_create()
mdcache->init_layouts();
snapserver->set_rank(whoami);
inotable->set_rank(whoami);
sessionmap.set_rank(whoami);
@ -1560,6 +1560,7 @@ void MDSRank::boot_create()
// initialize tables
if (mdsmap->get_tableserver() == whoami) {
dout(10) << "boot_create creating fresh snaptable" << dendl;
snapserver->set_rank(whoami);
snapserver->reset();
snapserver->save(fin.new_sub());
}