]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: disable misc internal activitiles when MDS is readonly
authorYan, Zheng <zyan@redhat.com>
Fri, 28 Nov 2014 08:21:35 +0000 (16:21 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 2 Dec 2014 02:47:23 +0000 (10:47 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/Migrator.cc

index d48ec638b0dd269eb9b5fb8b7dd42a7731a98151..568e1eb1095d29c69cb065869bd0d4bfb17984e8 100644 (file)
@@ -10443,6 +10443,10 @@ public:
 
 bool MDCache::can_fragment(CInode *diri, list<CDir*>& 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;
index 08a3210bc366204d55bf8cd4a3c4f992a5f1f207..2d20ced367d5257cc6ce3b55049271cd0396b3cb 100644 (file)
@@ -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) &&
index b95f861de18bc8c9bd72d6b295c2832dad14740d..50330708373b3e83acf3f8fda2d2172bad0b379f 100644 (file)
@@ -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.