From: xie xingguo Date: Mon, 27 Jun 2016 01:29:50 +0000 (+0800) Subject: os/bluestore: add sanity check when try to trim onode from cache X-Git-Tag: v11.0.0~31^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=06923a5f20ecff74c2004a6bfadb0d9b22435783;p=ceph.git os/bluestore: add sanity check when try to trim onode from cache We have verified that the onode size to be trimmed is positive ahead, so "p" shall never point to onode_lru.begin() below here. Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index fa3518f44fb2..478375e258d9 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -529,6 +529,7 @@ void BlueStore::LRUCache::trim(uint64_t onode_max, uint64_t buffer_max) return; // don't even try auto p = onode_lru.end(); + assert(p != onode_lru.begin()); --p; while (num > 0) { Onode *o = &*p; @@ -747,8 +748,8 @@ void BlueStore::TwoQCache::trim(uint64_t onode_max, uint64_t buffer_max) return; // don't even try auto p = onode_lru.end(); - if (num) - --p; + assert(p != onode_lru.begin()); + --p; while (num > 0) { Onode *o = &*p; int refs = o->nref.load();