From: Yan, Zheng Date: Fri, 28 Nov 2014 08:21:35 +0000 (+0800) Subject: mds: disable misc internal activitiles when MDS is readonly X-Git-Tag: v0.91~52^2~14^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=44d9abb567da022690092b74cf0cb89022baa98f;p=ceph.git mds: disable misc internal activitiles when MDS is readonly Signed-off-by: Yan, Zheng --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index d48ec638b0dd..568e1eb1095d 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -10443,6 +10443,10 @@ public: bool MDCache::can_fragment(CInode *diri, list& dirs) { + if (is_readonly()) { + dout(7) << "can_fragment: read-only FS, no fragmenting for now" << dendl; + return false; + } if (mds->mdsmap->is_degraded()) { dout(7) << "can_fragment: cluster degraded, no fragmenting for now" << dendl; return false; diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 08a3210bc366..2d20ced367d5 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -863,7 +863,7 @@ public: void eval_remote(CDentry *dn); void maybe_eval_stray(CInode *in, bool delay=false) { - if (in->inode.nlink > 0 || in->is_base()) + if (in->inode.nlink > 0 || in->is_base() || is_readonly()) return; CDentry *dn = in->get_projected_parent_dn(); if (!dn->state_test(CDentry::STATE_PURGING) && diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index b95f861de18b..50330708373b 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -728,6 +728,10 @@ void Migrator::export_dir(CDir *dir, mds_rank_t dest) assert(dir->is_auth()); assert(dest != mds->get_nodeid()); + if (mds->mdcache->is_readonly()) { + dout(7) << "read-only FS, no exports for now" << dendl; + return; + } if (mds->mdsmap->is_degraded()) { dout(7) << "cluster degraded, no exports for now" << dendl; return; @@ -2137,7 +2141,8 @@ void Migrator::handle_export_prep(MExportDirPrep *m) dout(7) << " all ready, noting auth and freezing import region" << dendl; bool success = true; - if (dir->get_inode()->filelock.can_wrlock(-1) && + if (!mds->mdcache->is_readonly() && + dir->get_inode()->filelock.can_wrlock(-1) && dir->get_inode()->nestlock.can_wrlock(-1)) { it->second.mut = MutationRef(new MutationImpl); // force some locks. hacky.