From: root Date: Fri, 1 Dec 2017 07:26:00 +0000 (+0800) Subject: cephfs: potential adjust failure in lru_expire X-Git-Tag: v12.2.3~68^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6eea75200fed82a2c5513795a79834527090957c;p=ceph.git cephfs: potential adjust failure in lru_expire 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 (cherry picked from commit 590c39eab02e64de7393c35ae7a9efb6ce626770) --- diff --git a/src/include/lru.h b/src/include/lru.h index d04e94f19a4..c52cb567bf1 100644 --- a/src/include/lru.h +++ b/src/include/lru.h @@ -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!