]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't pin dirfrag for DISCOVERBASE
authorYan, Zheng <zyan@redhat.com>
Fri, 28 Apr 2017 11:21:24 +0000 (19:21 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 11 May 2017 06:13:24 +0000 (14:13 +0800)
The reference triggers assertion when fragmentating the dirfrag.
pin parent inode instead.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/MDCache.cc
src/mds/MDCache.h

index 9a0208014bec8e181db632e1846a640772fa2bb5..c0433ec419baec13cae687b6ba439231b895c875 100644 (file)
@@ -6474,6 +6474,11 @@ bool MDCache::trim(int max, int count)
       if (!diri->is_auth()) {
        if (dir->get_num_ref() > 1)  // only subtree pin
          continue;
+       list<CDir*> ls;
+       diri->get_subtree_dirfrags(ls);
+       if (diri->get_num_ref() > (int)ls.size()) // only pinned by subtrees
+         continue;
+
        // don't trim subtree root if its auth MDS is recovering.
        // This simplify the cache rejoin code.
        if (dir->is_subtree_root() &&
@@ -9680,7 +9685,7 @@ void MDCache::discover_path(CDir *base,
       !base->is_waiting_for_dentry(want_path[0].c_str(), snap) || !onfinish) {
     discover_info_t& d = _create_discover(from);
     d.ino = base->ino();
-    d.pin_base(base);
+    d.pin_base(base->inode);
     d.frag = base->get_frag();
     d.snap = snap;
     d.want_path = want_path;
index 6447b009145c83c2cf47c6d1ac62fedcd01307cd..ca3cdff76d9860e78d48b187e6219cb0557c0757 100644 (file)
@@ -209,20 +209,20 @@ public:
     frag_t frag;
     snapid_t snap;
     filepath want_path;
-    MDSCacheObject *base;
+    CInode *basei;
     bool want_base_dir;
     bool want_xlocked;
 
     discover_info_t() :
-      tid(0), mds(-1), snap(CEPH_NOSNAP), base(NULL),
+      tid(0), mds(-1), snap(CEPH_NOSNAP), basei(NULL),
       want_base_dir(false), want_xlocked(false) {}
     ~discover_info_t() {
-      if (base)
-       base->put(MDSCacheObject::PIN_DISCOVERBASE);
+      if (basei)
+       basei->put(MDSCacheObject::PIN_DISCOVERBASE);
     }
-    void pin_base(MDSCacheObject *b) {
-      base = b;
-      base->get(MDSCacheObject::PIN_DISCOVERBASE);
+    void pin_base(CInode *b) {
+      basei = b;
+      basei->get(MDSCacheObject::PIN_DISCOVERBASE);
     }
   };