]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix inode count check in MDCache::check_memory_usage()
authorYan, Zheng <zyan@redhat.com>
Thu, 26 Oct 2017 08:21:41 +0000 (16:21 +0800)
committerShinobu Kinjo <shinobu@redhat.com>
Tue, 14 Nov 2017 04:32:26 +0000 (23:32 -0500)
Fixes: http://tracker.ceph.com/issues/21928
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 3ca602e3bdaa211ae2446d4bbf62431e14d41bef)

Conflicts:
src/mds/MDCache.cc

src/mds/CInode.cc
src/mds/MDCache.cc
src/mds/MDCache.h

index 633e6477553dda671318f2991d28dc1b2e4a621c..94a57ad7579a251e758a3ec85cc99e4b612dd8b9 100644 (file)
@@ -3808,7 +3808,10 @@ void CInode::validate_disk_state(CInode::validated_data *results,
     }
 
     ~ValidationContinuation() override {
-      delete shadow_in;
+      if (shadow_in) {
+       delete shadow_in;
+       in->mdcache->num_shadow_inodes--;
+      }
     }
 
     /**
@@ -3972,10 +3975,11 @@ next:
       assert(in->is_dir());
 
       if (in->is_base()) {
-        shadow_in = new CInode(in->mdcache);
-        in->mdcache->create_unlinked_system_inode(shadow_in,
-                                                  in->inode.ino,
-                                                  in->inode.mode);
+       if (!shadow_in) {
+         shadow_in = new CInode(in->mdcache);
+         in->mdcache->create_unlinked_system_inode(shadow_in, in->inode.ino, in->inode.mode);
+         in->mdcache->num_shadow_inodes++;
+       }
         shadow_in->fetch(get_internal_callback(INODE));
         return false;
       } else {
index b40833fd1cabbee3ebf15906d4df332f8239e677..90aa218480921a9551cd4a527179a411141d066b 100644 (file)
@@ -183,6 +183,7 @@ MDCache::MDCache(MDSRank *m, PurgeQueue &purge_queue_) :
     strays[i] = NULL;
   }
 
+  num_shadow_inodes = 0;
   num_inodes_with_caps = 0;
 
   max_dir_commit_size = g_conf->mds_dir_max_commit_size ?
@@ -7444,7 +7445,7 @@ void MDCache::check_memory_usage()
   static MemoryModel::snap baseline = last;
 
   // check client caps
-  assert(CInode::count() == inode_map.size());
+  assert(CInode::count() == inode_map.size() + snap_inode_map.size() + num_shadow_inodes);
   double caps_per_inode = 0.0;
   if (CInode::count())
     caps_per_inode = (double)Capability::count() / (double)CInode::count();
index 61a170bf6fd57b60baae3a613b89c0a9770afdce..19fcb1dfb7e872536a8daec7d1cd5b81c8695612 100644 (file)
@@ -201,6 +201,8 @@ public:
 
   DecayRate decayrate;
 
+  int num_shadow_inodes;
+
   int num_inodes_with_caps;
 
   unsigned max_dir_commit_size;