]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix trim_non_auth empty lru case
authorSage Weil <sage@newdream.net>
Thu, 25 Feb 2010 19:48:14 +0000 (11:48 -0800)
committerSage Weil <sage@newdream.net>
Thu, 25 Feb 2010 20:25:10 +0000 (12:25 -0800)
If our lru is empty, make sure we clean things out _after_
unpinning the subtrees!  This came up after an mds leaving the
cluster crashed before it finished, and on replay/rejoin had
no auth subtrees.

src/mds/MDCache.cc

index 9a411378fde0fa0b08b6c3e07d3c8e24e369b11e..129ffb76abee72b064e61e9b941f426ca7e2fc33 100644 (file)
@@ -4994,6 +4994,15 @@ void MDCache::trim_non_auth()
     }
   }
 
+  // move everything in the pintail to the top bit of the lru.
+  lru.lru_touch_entire_pintail();
+
+  // unpin all subtrees
+  for (map<CDir*, set<CDir*> >::iterator p = subtrees.begin();
+       p != subtrees.end();
+       p++) 
+    p->first->put(CDir::PIN_SUBTREETEMP);
+
   if (lru.lru_get_size() == 0) {
     // root, stray, etc.?
     hash_map<vinodeno_t,CInode*>::iterator p = inode_map.begin();
@@ -5007,10 +5016,12 @@ void MDCache::trim_non_auth()
        for (list<CDir*>::iterator p = ls.begin();
             p != ls.end();
             ++p) {
-         assert((*p)->get_num_ref() == 0);
+         dout(0) << " ... " << **p << dendl;
+         assert((*p)->get_num_ref() == 1);  // SUBTREE
          remove_subtree((*p));
          in->close_dirfrag((*p)->dirfrag().frag);
        }
+       dout(0) << " ... " << *in << dendl;
        assert(in->get_num_ref() == 0);
        remove_inode(in);
       }
@@ -5018,15 +5029,6 @@ void MDCache::trim_non_auth()
     }
   }
 
-  // move everything in the pintail to the top bit of the lru.
-  lru.lru_touch_entire_pintail();
-
-  // unpin all subtrees
-  for (map<CDir*, set<CDir*> >::iterator p = subtrees.begin();
-       p != subtrees.end();
-       p++) 
-    p->first->put(CDir::PIN_SUBTREETEMP);
-
   show_subtrees();
 }