From: Yan, Zheng Date: Fri, 28 Apr 2017 11:21:24 +0000 (+0800) Subject: mds: don't pin dirfrag for DISCOVERBASE X-Git-Tag: v12.1.0~10^2~28^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b4e0d12c4d00e4994eff3d8fda83b024cd90f4bb;p=ceph.git mds: don't pin dirfrag for DISCOVERBASE The reference triggers assertion when fragmentating the dirfrag. pin parent inode instead. Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 9a0208014bec..c0433ec419ba 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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 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; diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 6447b009145c..ca3cdff76d98 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -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); } };