From 6aa49243d2d1a42c6703d1eec82be9fa96c1234b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 25 Feb 2010 11:48:14 -0800 Subject: [PATCH] mds: fix trim_non_auth empty lru case 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 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 9a411378fde0f..129ffb76abee7 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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 >::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::iterator p = inode_map.begin(); @@ -5007,10 +5016,12 @@ void MDCache::trim_non_auth() for (list::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 >::iterator p = subtrees.begin(); - p != subtrees.end(); - p++) - p->first->put(CDir::PIN_SUBTREETEMP); - show_subtrees(); } -- 2.39.5