Skip to content

Commit

Permalink
cephfs: potential adjust failure in lru_expire
Browse files Browse the repository at this point in the history
Fix: the first adjust is no needed,it will never take real effect.
     the second 'adjust' may never get the chance to be executed
     suppose we can reach the second 'adjust', it will crash because the bottom list is empty now.

Signed-off-by: dongdong tao <tdd21151186@gmail.com>
  • Loading branch information
taodd committed Dec 1, 2017
1 parent 8723353 commit e87cb41
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/include/lru.h
Expand Up @@ -157,14 +157,14 @@ class LRU {

// expire -- expire a single item
LRUObject *lru_get_next_expire() {
adjust();
// look through tail of bot
while (bottom.size()) {
LRUObject *p = bottom.back();
if (!p->lru_pinned) return p;

// move to pintail
pintail.push_front(&p->lru_link);
adjust();
}

// ok, try head then
Expand All @@ -174,7 +174,6 @@ class LRU {

// move to pintail
pintail.push_front(&p->lru_link);
adjust();
}

// no luck!
Expand Down

0 comments on commit e87cb41

Please sign in to comment.