]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: check export_pin on dirfrag load
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 3 May 2017 14:39:48 +0000 (10:39 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 4 May 2017 02:37:19 +0000 (22:37 -0400)
Zheng's suggestion: "[maybe_export_pin is called by MDCache::add_inode() and
Migrator. For the first case, inode has no dirfrag (I think it's better to call
this function in CInode::get_or_open_dirfrag)"

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/CInode.cc
src/mds/CInode.h
src/mds/MDCache.cc

index 46bc035237ac6219e1180319adfdf7b27c998a0b..4eade9fce5f799075b521145e4c47d48993ba5e9 100644 (file)
@@ -655,6 +655,13 @@ CDir *CInode::add_dirfrag(CDir *dir)
     dir->get(CDir::PIN_STICKY);
   }
 
+  if (get_export_pin(false) != mdcache->mds->get_nodeid()) {
+    /* We don't need to look at parents export pins as that would be done when
+     * the parent's dirfrags are loaded.
+     */
+    maybe_export_pin();
+  }
+
   return dir;
 }
 
@@ -4486,7 +4493,7 @@ void CInode::set_export_pin(mds_rank_t rank)
   maybe_export_pin();
 }
 
-mds_rank_t CInode::get_export_pin(void) const
+mds_rank_t CInode::get_export_pin(bool inherit) const
 {
   /* An inode that is export pinned may not necessarily be a subtree root, we
    * need to traverse the parents. A base or system inode cannot be pinned.
@@ -4498,6 +4505,7 @@ mds_rank_t CInode::get_export_pin(void) const
     if (pin >= 0) {
       return pin;
     }
+    if (!inherit) break;
   }
   return MDS_RANK_NONE;
 }
index 85324882bfa7896f9c734995540f790c5dfd94a9..05659df80c2beb72fff2cf5e2144eaa67301be74 100644 (file)
@@ -1092,7 +1092,7 @@ private:
   void maybe_export_pin();
 public:
   void set_export_pin(mds_rank_t rank);
-  mds_rank_t get_export_pin(void) const;
+  mds_rank_t get_export_pin(bool inherit=true) const;
   bool is_exportable(mds_rank_t dest) const;
 
   void print(ostream& out) override;
index 5a58b7b85705e6fbe564ed0cae34aa1534b26489..4954fdc22eada0a8ef8d78b5f09e365399a88c44 100644 (file)
@@ -271,9 +271,6 @@ void MDCache::add_inode(CInode *in)
         g_conf->mds_cache_size * g_conf->mds_health_cache_threshold) {
     exceeded_size_limit = true;
   }
-
-  /* This is the place where inodes are thrown in the cache, so check if the inode should be somewhere else: */
-  in->maybe_export_pin();
 }
 
 void MDCache::remove_inode(CInode *o)