From c294051987de1ff79540060a0563fa02c8f03f91 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Wed, 13 Sep 2017 11:27:18 +0800 Subject: [PATCH] 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" --- src/mds/MDCache.cc | 3 ++- src/mds/Migrator.cc | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index a02ddb937df..ba9ecc361a1 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6498,7 +6498,8 @@ bool MDCache::trim(int max, int count) if (!diri->is_auth() && !diri->is_base() && dir->get_num_head_items() == 0) { 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; migrator->export_empty_import(dir); diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 382fb703a70..b10bc3bd560 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -776,6 +776,10 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest) assert(dir->is_auth()); 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()) { dout(7) << "read-only FS, no exports for now" << dendl; return; @@ -793,10 +797,6 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest) //ceph_abort(); 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() && dir->inode->get_projected_parent_dir()->get_parent_dir()->ino() != MDS_INO_MDSDIR(dest)) { -- 2.39.5