]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: potential adjust failure in lru_expire 19627/head
authorroot <tdd108128@163.com>
Fri, 1 Dec 2017 07:26:00 +0000 (15:26 +0800)
committerShinobu Kinjo <shinobu@redhat.com>
Thu, 21 Dec 2017 10:04:38 +0000 (19:04 +0900)
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.

Fixes: http://tracker.ceph.com/issues/22458
Signed-off-by: dongdong tao <tdd21151186@gmail.com>
(cherry picked from commit 590c39eab02e64de7393c35ae7a9efb6ce626770)

src/include/lru.h

index d04e94f19a471f842e78cc74a335faaf5024bdd6..c52cb567bf158509044c924e90d500d8ad15edb5 100644 (file)
@@ -157,6 +157,7 @@ public:
 
   // expire -- expire a single item
   LRUObject *lru_get_next_expire() {
+    adjust();
     // look through tail of bot
     while (bottom.size()) {
       LRUObject *p = bottom.back();
@@ -164,7 +165,6 @@ public:
 
       // move to pintail
       pintail.push_front(&p->lru_link);
-      adjust();
     }
 
     // ok, try head then
@@ -174,7 +174,6 @@ public:
 
       // move to pintail
       pintail.push_front(&p->lru_link);
-      adjust();
     }
     
     // no luck!