ceph: fix "stopping mds can't export subtree"

caused by commit
790c34138f "Make standby-replay mds avoid initiating subtree export"

Fixes: http://tracker.ceph.com/issues/21378
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
This commit is contained in:
Yan, Zheng 2017-09-13 11:27:18 +08:00
parent e4b1942cb7
commit c294051987
2 changed files with 6 additions and 5 deletions

View File

@ -6498,7 +6498,8 @@ bool MDCache::trim(int max, int count)
if (!diri->is_auth() && !diri->is_base() && if (!diri->is_auth() && !diri->is_base() &&
dir->get_num_head_items() == 0) { dir->get_num_head_items() == 0) {
if (dir->state_test(CDir::STATE_EXPORTING) || if (dir->state_test(CDir::STATE_EXPORTING) ||
dir->is_freezing() || dir->is_frozen() || !mds->is_active()) !(mds->is_active() || mds->is_stopping()) ||
dir->is_freezing() || dir->is_frozen())
continue; continue;
migrator->export_empty_import(dir); migrator->export_empty_import(dir);

View File

@ -776,6 +776,10 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest)
assert(dir->is_auth()); assert(dir->is_auth());
assert(dest != mds->get_nodeid()); assert(dest != mds->get_nodeid());
if (!(mds->is_active() || mds->is_stopping())) {
dout(7) << "i'm not active, no exports for now" << dendl;
return;
}
if (mds->mdcache->is_readonly()) { if (mds->mdcache->is_readonly()) {
dout(7) << "read-only FS, no exports for now" << dendl; dout(7) << "read-only FS, no exports for now" << dendl;
return; return;
@ -793,10 +797,6 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest)
//ceph_abort(); //ceph_abort();
return; return;
} }
if (!mds->is_active()) {
dout(7) << "i'm not active, no exports for now" << dendl;
return;
}
if (!dir->inode->is_base() && dir->inode->get_projected_parent_dir()->inode->is_stray() && if (!dir->inode->is_base() && dir->inode->get_projected_parent_dir()->inode->is_stray() &&
dir->inode->get_projected_parent_dir()->get_parent_dir()->ino() != MDS_INO_MDSDIR(dest)) { dir->inode->get_projected_parent_dir()->get_parent_dir()->ino() != MDS_INO_MDSDIR(dest)) {