]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix inode count check in MDCache::check_memory_usage() 18555/head
authorYan, Zheng <zyan@redhat.com>
Thu, 26 Oct 2017 08:21:41 +0000 (16:21 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 1 Nov 2017 10:42:32 +0000 (18:42 +0800)
Fixes: http://tracker.ceph.com/issues/21928
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CInode.cc
src/mds/MDCache.cc
src/mds/MDCache.h

index d07da8a7aba55956721a597ecfada67aefcdd832..94b1eb2fed2c101d1b73e578a1f415c88c24965d 100644 (file)
@@ -3816,7 +3816,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--;
+      }
     }
 
     /**
@@ -3980,10 +3983,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 17068a64ca2deb9c2033d97634feb950e0bd0f07..5c04df4e1d5ecee85c68c45f21a8e1acfb3568c8 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 ?
@@ -7418,7 +7419,7 @@ void MDCache::check_memory_usage()
   static MemoryModel::snap baseline = last;
 
   // check client caps
-  assert(CInode::count() == inode_map.size() + snap_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 a2ab48751a0b92ac4d1b329c3574c9aa685c84d6..9429d39422c56a042eae1ee86f989ad4f0e963d7 100644 (file)
@@ -202,6 +202,8 @@ public:
 
   DecayRate decayrate;
 
+  int num_shadow_inodes;
+
   int num_inodes_with_caps;
 
   unsigned max_dir_commit_size;