From: Yan, Zheng Date: Mon, 15 May 2017 02:28:06 +0000 (+0800) Subject: mds: fix MDCache::trim_non_auth() X-Git-Tag: v12.1.0~128^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2fa16d018d2ee86363796ea52df5aed81bfa30a2;p=ceph.git mds: fix MDCache::trim_non_auth() After introducing the bottom_lru, "stop when we see a dentry the second time" no longer works. Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 4136e8f68b6ad..9eeca5c7c452d 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6806,9 +6806,7 @@ void MDCache::trim_non_auth() ++p) p->first->get(CDir::PIN_SUBTREETEMP); - // note first auth item we see. - // when we see it the second time, stop. - CDentry *first_auth = 0; + list auth_list; // trim non-auth items from the lru for (;;) { @@ -6824,20 +6822,10 @@ void MDCache::trim_non_auth() if (dn->is_auth()) { // add back into lru (at the top) - if (dn->state_test(CDentry::STATE_BOTTOMLRU)) - bottom_lru.lru_insert_mid(dn); - else - lru.lru_insert_top(dn); + auth_list.push_back(dn); if (dnl->is_remote() && dnl->get_inode() && !dnl->get_inode()->is_auth()) dn->unlink_remote(dnl); - - if (!first_auth) { - first_auth = dn; - } else { - if (first_auth == dn) - break; - } } else { // non-auth. expire. CDir *dir = dn->get_dir(); @@ -6875,6 +6863,13 @@ void MDCache::trim_non_auth() } } + for (auto dn : auth_list) { + if (dn->state_test(CDentry::STATE_BOTTOMLRU)) + bottom_lru.lru_insert_mid(dn); + else + lru.lru_insert_top(dn); + } + // move everything in the pintail to the top bit of the lru. lru.lru_touch_entire_pintail();