]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix MDCache::trim_non_auth()
authorYan, Zheng <zyan@redhat.com>
Mon, 15 May 2017 02:28:06 +0000 (10:28 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 24 May 2017 08:36:09 +0000 (16:36 +0800)
After introducing the bottom_lru,  "stop when we see a dentry the
second time" no longer works.

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

index 4136e8f68b6adf443de7b524f633414469c886ed..9eeca5c7c452dcba6efba3cf5301cb49a91f5e7e 100644 (file)
@@ -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<CDentry*> 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();